随笔- 310
文章- 1
评论- 0
阅读-
85655
随笔分类 - php
curl curl请求
摘要:$params=[ "a"=>"test", "b"=>"测试" ]; $header=[ "Content-Type: application/json; charset=utf-8", "host: www.baidu.com" ]; $url="https://www.baidu.com/pa
阅读全文
php json_encode使用中文不转码
摘要:PHP转JSON,中文会被转码成unicode,使用常量JSON_UNESCAPED_UNICODE可以使中文原样输入 echo json_encode("中文"); //Output: "\u4e2d\u6587" echo json_encode("中文", JSON_UNESCAPED_UNI
阅读全文
字符串中字符转换
摘要:ucfirst() 函数把字符串中的首字符转换为大写。 相关函数: lcfirst() - 把字符串中的首字符转换为小写 ucwords() - 把字符串中每个单词的首字符转换为大写 strtoupper() - 把字符串转换为大写 strtolower() - 把字符串转换为小写
阅读全文
php unicode转为汉字
摘要:function u2c($str){ return preg_replace_callback("#\\\u([0-9a-f]{4})#i", function ($r) { return iconv('UCS-2BE', 'UTF-8', pack('H4', $r[1]));},$str);
阅读全文
php 新建对象
摘要:class Car { var $color; function __construct($color="green") { $this->color = $color; } function what_color() { return $this->color; } }
阅读全文
php常用全局函数
摘要:print_r (count(array_keys([1]))); //打印数组 str_replace("world","Shanghai","Hello world!") //把字符串 "Hello world!" 中的字符 "world" 替换为 "Shanghai" array_keys()
阅读全文