后端开发2025年05月10日
1.格式 <!doctype html> 声明文档类型,说明html版本号 <html> 说明代码格式 <head> 网页的头部 <meta charset="utf-8"> 定义网页字符集,关键词等内容:例如:<meta name=”keywords” content=”html”> <t...
后端开发2025年05月09日
&lt;?php $dir = '你要删除的目录路径'; //如下: //$dir = $_SERVER['DOCUMENT_ROOT'].'/cache'; rmdirs($dir); //php删除指定目录下的的文件-用PHP怎么删除某目录下指定的一个文件? function rmdirs($dir){ //error_reporting(0)...
后端开发2025年05月09日
需要借助PHPExcel这个库 $excelPath = 'Test.xls'; $objReader = PHPExcel_IOFactory::createReader('Excel5'); $objReader-&gt;setReadDataOnly(true); $objPHPExcel = $objReader-&gt;load(...
后端开发2025年05月09日
在windows服务器开启php的gd库时,使用cgi之后phpinfo()得到的结果中 Configure Command 中并没有出现gd. Configure Command 后显示的是: cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enabl...
后端开发2025年05月09日
在http传输文本中,规定必须 header和content顺序必须是:header在前content在后,并且header的格式必须满足“keyword: value\n”这种格式。 1、在header输出之前有输出内容的话,就会造成对header的错误理解(尽管现在已经能容错了),例如不是满足“keyword: value\n”的格式还好,直接错误了,...
后端开发2025年05月09日
&lt;?php$onlineip = $_SERVER['REMOTE_ADDR'];//服务器在局域网的话,那么显示的则是内网IPecho $onlineip;?&gt;如果服务器在外网的话,那么访问的话获得的是外网的IP,无法获取内网IP。 ...
后端开发2025年05月08日
可参考上篇文章 链接 PHP数组简写模式 同样是PHP版本问题:in_array()函数 第二个参数应该为数组 但是 lnmp下,PHP5.3不报错,wamp下PHP5.5报以下错误: echo "<br>For in_array:"; $arrstr="weibhd1"; if(in_array("weibhd1",$arrstr)) { e...
后端开发2025年05月08日
接手遗留项目前后台同一域名 前台test.com/... 后台 test.com/admin 在处理后台管理账号session过期时间时发现 前后台session cookie未区分path导致 前后台退出互相影响. 解决如下 找到项目入口文件 $request_uri = $_SERVER['REQUEST_URI']; if (strpos($requ...
后端开发2025年05月08日
从数据库取出数据数组格式保存 file_put_contents('/tmp/bak_trusted_list'.date('H').'.php', '&lt;?php return '.var_export($list, true).';?&gt;'); ...
后端开发2025年05月08日
1. 停止命令 pkill php-fpm 2.重启或启动命令 php-fpm -R ...