随笔分类 - PHP
摘要:SELECT CAST(id AS char) AS id FROM `table_name` 我也不知道为啥会导致自动四舍五入,有知道的吗?
阅读全文
摘要:在Base控制器里写: View::assign('aaa','123');
阅读全文
摘要:/** * @param $arr array 数组 * @param $key string 唯一键 * @return array */ function getArrayUniqueByKeys(array $arr, string $key):array { if (isset($arr[0
阅读全文
摘要:hexdec(uniqid()) hexdec(uniqid())
阅读全文
摘要:/** * 格式化打印:JSON字符串|对象|数组 * @param string|array $data */ public static function Console($data) { if (is_string($data) && 0 < strlen($data) && self::is
阅读全文
摘要:location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; break; } }
阅读全文
摘要:<?php function getMonthStartAndEnd($timestamp){ $startTime = strtotime(date("Y-m-01 00:00:00",$timestamp)); $startTimeStr = date("Y-m-d H:i:s",$startT
阅读全文
摘要:<?php function validateDate($date, $format = 'Y-m-d H:i:s') { $d = DateTime::createFromFormat($format, $date); return $d && $d->format($format) == $da
阅读全文
摘要:Selector.php下载:先把图片文件下载,然后把扩展名改成.zip,最后解压缩 <?php require "selector.php"; function getGasolinePrice() { try { $curl = curl_init(); curl_setopt_array($c
阅读全文
摘要:<?php //定义一个数组 $array = array(0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd'); //使用 array_search('要搜索的值',数组); $key = array_search('b', $array); // $key = 1; $
阅读全文
摘要:function randString():string { $code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $rand = $code[rand(0,25)] .strtoupper(dechex(date('m'))) .date('d').substr(time()
阅读全文
摘要:创建模型: php artisan make:model Models/User 创建控制器: php artisan admin:make UserController --model=App\\Models\\User php artisan cache:clear php artisan co
阅读全文
摘要:public static function object_array($array) { if(is_object($array)) { $array = (array)$array; } if(is_array($array)) { foreach($array as $key=>$value)
阅读全文
摘要:$grid->paginate(100000000)->applyFilter();
阅读全文
摘要:/** * @param $keywords string * @param $field string * @return array|string */ public function advance_where_or($field,$keywords) { $keywords = trim($
阅读全文
摘要:创建控制器: // Windows php artisan admin:make UserController --model=App\User app\Admin\routes.php <?php use App\Admin\Controllers\UserController; use Enco
阅读全文