This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 直接用 official image,可以省下很多工 | |
FROM php:7.4.9-fpm-alpine | |
COPY php.ini $PHP_INI_DIR/conf.d/ | |
# 安裝 php extensions 的神器,請務必一試! | |
# https://github.com/mlocati/docker-php-extension-installer | |
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/ | |
RUN install-php-extensions redis mysqli xdebug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a := map[string]interface{} {"name": "Charlie", "age": 20} | |
b := map[string]interface{} {"name": "Charlie", "age": 20} | |
fmt.Printf("a: %v\nb: %v\nDeepEqual:%v\n", a, b, reflect.DeepEqual(a, b)) | |
fmt.Printf("(%T) %v\n", b["age"], b["age"]) | |
err := json.Unmarshal([]byte(`{"name": "Charlie", "age": 20}`), &b) | |
if err != nil { | |
panic("oops") | |
} | |
fmt.Printf("a: %v\nb: %v\nDeepEqual:%v\n", a, b, reflect.DeepEqual(a, b)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a := map[string]interface{} {"name": "Charlie", "age": 20} | |
b := map[string]interface{} {"name": "Charlie", "age": 20} | |
fmt.Printf("a: %v\nb: %v\nDeepEqual:%v\n", a, b, reflect.DeepEqual(a, b)) | |
err := json.Unmarshal([]byte(`{"name": "Charlie", "age": 20}`), &b) | |
if err != nil { | |
panic("oops") | |
} | |
fmt.Printf("a: %v\nb: %v\nDeepEqual:%v\n", a, b, reflect.DeepEqual(a, b)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
//str := "能解此愁,唯有杜康!" | |
//str := `"{"data":"中文"}"` | |
str := []byte(`"{"data":"中文"}"`) | |
fmt.Printf("string: %s\n", str) | |
//fmt.Println("String length:", len([]rune(str))) | |
fmt.Println("String length:", len([]byte(str))) | |
fmt.Println(" Bytes length:", len(str)) | |
fmt.Println("------------------------------------") | |
fmt.Println("cnt index rune char bytes") |