零碎知识点
return redirect('admin/banner')->with('success', '添加成功'); 重定向并加上 Session 闪存数据laravel文档 @include('admin.main.__message'),暂时先用这个模板{!! $oWikiLists->appends(request()->all())->links() !!} {!! $oWikiLists->appends(['status' => request()->get('status')])->links() !!}//过滤非法特殊字符串 $nickname = iconv('gb2312//ignore', 'utf-8', iconv('utf-8', 'gb2312//ignore', $nickname)); 注意事项info()或use Illuminate\Support\Facades\Log; Log::info() 存日志的方式查看,中间用.连接$sPicturePath = str_replace("http", "https", $aReturn['data']['avatar_url']); 将http转成https,或者在asset(“", true)中第二个参数传true"text" => array(
"content" => $sSendUserName . '给您发送了祝福' . ('<a href="www.baidu.com">点击查看>>></a>'),
"content1" => "<a href='www.baidu.com'>点击查看>>></a>" . $sSendUserName . "给您发送了祝福"
"content" => $sSendUserName . '给您发送了祝福' . ("<a href='$sJumpLink'>点击查看>>></a>"),
"content" => $sSendUserName . '给您发送了祝福' . "<a href='{$v["jumplink"]}'>点击查看>>></a>"
),
date(“Y-m-d H:i:s”,time()),与当前时间不一致,修改php.ini 中的date.timezone = PRC 由UTC改成PRCJSON_UNESCAPED_UNICODE 可以防止中文编码$a = array(); 5.4版本之后可以用$a = [],接口返回的json数组也要用arrayreturn json_encode(array('success'=>true));,反正只要是数组的地方5.4版本之前的都要用[]JSON_UNESCAPED_UNICODE json_encode会把中文进行Unicode编码,添加这个属性就不会,但是PHP版本5.3以前不支持,可以换成下面这个函数function json_encode_ex($value)
{
if (version_compare(PHP_VERSION,'5.4.0','<'))
{
$str = json_encode($value);
$str = preg_replace_callback(
"#\\\u([0-9a-f]{4})#i",
function($matchs)
{
return iconv('UCS-2BE', 'UTF-8', pack('H4', $matchs[1]));
},
$str
);
return $str;
}
else
{
return json_encode($value, JSON_UNESCAPED_UNICODE);
}
}
在使用json_encode的地方,换成调用这个方法。
list($dst_w, $dst_h, $dst_type) = getimagesize($target_path);
getimagesize($target_path); 输出为array:7 [▼
0 => 1024 对应$dst_w
1 => 768 对应$dst_h
2 => 2 对应$dst_type
3 => "width="1024" height="768""
"bits" => 8
"channels" => 3
"mime" => "image/jpeg"
]
array_column($array, 'disease_id');,也可以传递第三个参数作为键,如果没有传第三个则键为0if (strpos($a, '[') !== false) {}