
PHP
清风扶窑
这个作者很懒,什么都没留下…
展开
-
数组指定位置添加元素(索引数组、关联数组)
【代码】数组指定位置添加元素(索引数组、关联数组)原创 2024-07-18 10:40:55 · 369 阅读 · 1 评论 -
获取两个时间段的交集
时间段a 开始a1 结束a2时间段b 开始b1 结束b2时间段a与时间段b的交集出现在a2>b1 && a1<b2 的时候原创 2021-10-03 22:29:56 · 567 阅读 · 0 评论 -
left join 一对多时数据合并处理
function list(){ $arr = [ [ 'id' => 1, 'name' => '张三', 'title' => '深圳', ], [ 'id' => 1, 'name' => '张三', ...原创 2021-10-02 04:05:03 · 1532 阅读 · 0 评论 -
php 获取某一个指定时间点(时间戳)的上周周一的起始时间戳(00:00)
PHP获取某一个指定时间点(时间戳)的上周周一的起始时间戳(00:00)//获取某一个指定时间点(时间戳)的上周周一的起始时间戳(00:00)$start_time = strtotime('monday last week', $time);原创 2021-09-11 16:52:13 · 527 阅读 · 0 评论 -
PHP 抓取静态页面,解决文件编码问题 UTF-8,GBK
public function test() {// $url = 'http://finance.people.com.cn/n1/2021/0824/c1004-32204729.html'; //gpk// $url = 'https://sz.oeeee.com/html/202109/07/1133661.html';// $url = 'http://opinion.people.com.cn/GB/8213/420650/in...原创 2021-09-08 14:05:44 · 294 阅读 · 0 评论 -
php检测文件内容编码的方法
<?phpheader("Content-type: text/html; charset=utf-8");/** * 获取内容的编码 * @param string $str */function get_encoding($str = "") { $encodings = array ( 'ASCII', 'UTF-8', 'GBK' ); foreach ( $encodings as $encoding原创 2021-09-08 13:42:43 · 546 阅读 · 0 评论 -
apache、nginx伪静态
伪静态apache:<IfModule mod_rewrite.c>RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]</IfModule>2.nginx: location / { index index.html ind原创 2021-09-06 09:25:10 · 90 阅读 · 0 评论 -
PHP 批量生成名字和头像插入数据库
<?phpnamespace app\api\controller;use think\facade\Db;class Test{ public function sql() { $length = 1000; $data = []; for ($i = 0; $i < $length; $i++) { $phone = '1' . mt_rand(1000000000, 9999999原创 2021-08-29 22:03:13 · 679 阅读 · 0 评论