随笔分类 -  PHP

摘要:SELECT CAST(id AS char) AS id FROM `table_name` 我也不知道为啥会导致自动四舍五入,有知道的吗? 阅读全文
posted @ 2022-07-15 16:09 _迷途 阅读(50) 评论(0) 推荐(0) 编辑
摘要:在Base控制器里写: View::assign('aaa','123'); 阅读全文
posted @ 2022-04-11 15:50 _迷途 阅读(42) 评论(0) 推荐(0) 编辑
摘要:/** * @param $arr array 数组 * @param $key string 唯一键 * @return array */ function getArrayUniqueByKeys(array $arr, string $key):array { if (isset($arr[0 阅读全文
posted @ 2022-03-11 15:53 _迷途 阅读(59) 评论(0) 推荐(0) 编辑
摘要:hexdec(uniqid()) hexdec(uniqid()) 阅读全文
posted @ 2022-03-03 13:15 _迷途 阅读(371) 评论(0) 推荐(0) 编辑
摘要:/** * 格式化打印:JSON字符串|对象|数组 * @param string|array $data */ public static function Console($data) { if (is_string($data) && 0 < strlen($data) && self::is 阅读全文
posted @ 2022-01-14 15:17 _迷途 阅读(193) 评论(0) 推荐(0) 编辑
摘要:location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; break; } } 阅读全文
posted @ 2022-01-13 10:12 _迷途 阅读(1287) 评论(0) 推荐(0) 编辑
摘要:<?php function getMonthStartAndEnd($timestamp){ $startTime = strtotime(date("Y-m-01 00:00:00",$timestamp)); $startTimeStr = date("Y-m-d H:i:s",$startT 阅读全文
posted @ 2021-12-30 16:05 _迷途 阅读(146) 评论(0) 推荐(0) 编辑
摘要:<?php function validateDate($date, $format = 'Y-m-d H:i:s') { $d = DateTime::createFromFormat($format, $date); return $d && $d->format($format) == $da 阅读全文
posted @ 2021-12-30 16:02 _迷途 阅读(1805) 评论(0) 推荐(0) 编辑
摘要:Selector.php下载:先把图片文件下载,然后把扩展名改成.zip,最后解压缩 <?php require "selector.php"; function getGasolinePrice() { try { $curl = curl_init(); curl_setopt_array($c 阅读全文
posted @ 2021-11-24 13:46 _迷途 阅读(145) 评论(0) 推荐(0) 编辑
摘要:<?php //定义一个数组 $array = array(0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd'); //使用 array_search('要搜索的值',数组); $key = array_search('b', $array); // $key = 1; $ 阅读全文
posted @ 2021-10-26 17:45 _迷途 阅读(851) 评论(0) 推荐(0) 编辑
摘要:function randString():string { $code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $rand = $code[rand(0,25)] .strtoupper(dechex(date('m'))) .date('d').substr(time() 阅读全文
posted @ 2021-10-22 17:30 _迷途 阅读(381) 评论(0) 推荐(0) 编辑
摘要:创建模型: php artisan make:model Models/User 创建控制器: php artisan admin:make UserController --model=App\\Models\\User php artisan cache:clear php artisan co 阅读全文
posted @ 2021-08-23 13:53 _迷途 阅读(91) 评论(0) 推荐(0) 编辑
摘要:public static function object_array($array) { if(is_object($array)) { $array = (array)$array; } if(is_array($array)) { foreach($array as $key=>$value) 阅读全文
posted @ 2021-07-02 18:03 _迷途 阅读(37) 评论(0) 推荐(0) 编辑
摘要:$grid->paginate(100000000)->applyFilter(); 阅读全文
posted @ 2021-07-01 17:24 _迷途 阅读(383) 评论(0) 推荐(0) 编辑
摘要:/** * @param $keywords string * @param $field string * @return array|string */ public function advance_where_or($field,$keywords) { $keywords = trim($ 阅读全文
posted @ 2021-06-22 16:55 _迷途 阅读(143) 评论(0) 推荐(0) 编辑
摘要:创建控制器: // Windows php artisan admin:make UserController --model=App\User app\Admin\routes.php <?php use App\Admin\Controllers\UserController; use Enco 阅读全文
posted @ 2021-06-10 11:41 _迷途 阅读(1081) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示