官方文档:https://laravel.com/docs/5.5/csrf 客户端请求设置 表单添加隐藏域 <form method="POST" action="/profile"> {{ csrf_field() }} ..
Composer 注意:执行 composer 命令之前必须引入PHP环境变量 export PATH=$PATH:/data/server/php7/bin Nginx配置 location / { try_files $uri $uri/ /index.php?$query_strin
设置缓存 // put方式 Cache::put('key', 'value', $minutes); // 设置文件缓存 Cache::store('file')->get('key'); // 使用redi
升级Composer C:\Users\yezhou>composer self-update You are already using composer version 1.2.1 (stable channel). 升级Laravel安装器 C:\Users\yezhou>com
PHP下划线和驼峰字符串相互转换 class AppBlogString { /* * 下划线转驼峰 */ public static function convertUnderline($str) { $str = preg_repla
iconv 和 mb_convert_encoding 的区别 string iconv(string in_charset, string out_charset, string str) 注意:第二个参数,除了可以指定要转化到的编码以外,还可以增加两个后缀://TRANSLIT 和 //IGN
igbinary 官网:http://pecl.php.net/package/igbinary Github:https://github.com/igbinary/igbinary/ # wget http://pecl.php.net/get/igbinary-2.0.1.tgz # t
以ip.cn为例,根据IP地址在线查询省市区 <?php $url='https://ip.cn/index.php?ip=8.8.8.8'; $data["country"] = 'unknown'; $data["r
strpos() - 查找字符串在另一字符串中第一次出现的位置(区分大小写) stripos() - 查找字符串在另一字符串中第一次出现的位置(不区分大小写) strrpos() - 查找字符串在另一字符串中最后一次出现的位置(区分大小写) strripos() - 查找字符串在另一字符串中最后一次
json_decode($json); 直接转义json字符串数据后会发现转义后的数据时对象类型 想要获得数组类型,需加一个布尔参数 json_decode($json, true);
$params = array(); foreach ($_POST as $key => $value) { $params[$key] = $value; } if (empty($params)) { $params_str = file_get_contents(&q
MD5已经不是那么安全了,采用字典可暴力破解,通常采用加盐的MD5或者HMAC-MD5提升安全性。 <?php /** * 基于MD5的加密算法HMAC * * @param String $data 预加密数据 * @param String $key 密钥 * @retur
默认情况下PHP使用 json_encode 对数组进行 json格式转换时会自动将数据中含有斜杠的字符串进行转义,但往往并不需要转义,看起来不清晰而且占用存储空间。 对于如下数组 $a,现有两种办法解决: $a = array( 'http://www.appblog.cn
(int) <?php $foo = "1"; // $foo 是字符串类型 $bar = (int) $foo; // $bar 是整型 ?> intval() <?php $foo = "1";
需要root账户权限 $conn = mysqli_connect("localhost", "root", "123456") or die("数据库服务器连接失败"); $ret = mysqli_query($c