欢迎光临 - 我的站长站,本站所有资源仅供学习与参考,禁止用于商业用途或从事违法行为!

php教程

  • 数据太大导致php运行超时报错500Internal Server Error

    一次性调用的数据太大,就会导致php运行超时,继而报错500Internal Server Error的可能,这里分享几种解决方法。1,清缓存数据foreach ($data as $k => $v) { $num ++; if ($num == $limit) {//清空内存防止溢出 ob_flush(); flush(); $num = 0; ...

    621年前
  • 使用filesize()函数报错:stat failed for

    我们在使用PHP的filesize()函数获取文件大小时,发生了message:filesize(): stat failed for的错误,如下:message:filesize(): stat failed for F:s2017\SinaImgUpload\SinaImgUpload\bin\Debug\TempPath\Cookies.txt检测了路径是正确的,但怎么都获...

    441年前
  • php获取远程文件大小教程

    php获取远程文件大小就需要用到curl来访问远程文件,然后返回文件大小单位为字节。<?php// 获取远程文件大小函数function remote_filesize($url, $user = "", $pw = ""){ ob_start(); $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEAD...

    631年前
  • php随机生成大小写字符串函数

    字符串函数方法function createRandomStr($length){$str = &#39;0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&#39;;//62个字符$strlen = 62;while($length > $strlen){$str .= $str;$strlen += 62;}$str = str_shuffle($str);r...

  • PHP获取文件体积大小+体积单位字节

    PHP获取文件大小PHP获取文件体积大小只需要通过PHP filesize函数就可以。如:echo filesize(&#39;test.png&#39;);PHP获取文件单位PHP获取文件体积单位字节需要判断大小,再来分配单位,文件大小常见的单位表示还有KB、MB、GB、TB等格式。function transf_...

    701年前
  • php的增删改基础教程

    增加数据<?phpinclude("linksql.php");$add="inset into new1(table,content) values(&#39;qwerty&#39;,&#39;qasedfdssddsd&#39;)";if($coon->query($add))echo "插入成功";elseecho "插入失败".$coon->error;conn-&gt...

    361年前
  • Nginx禁止指定目录执行PHP

    在PHP开发中,某些目录的PHP文件不需要用户执行访问,为了安全我们是可以直接禁止访问的。这里我的站长站就分享了一篇Nginx禁止指定目录执行PHP ,可以轻松禁止某个目录执行脚本。location ~* ^/(uploads|templets|data)/.*.(php|php5)$ { return 444; ...

  • file_get_contents函数访问大文件超时解决方法

    file_get_contents函数在访问大文件时,会报错504超时,下面分享下我的站长站的解决方法。$opts = array(&#39;http&#39;=>array(&#39;method&#39;=>"GET",&#39;timeout&#39;=>60,)); $context = stream_context_create($opts); $html =file_get_content...

    431年前
  • php上传大文件报错Internal Server Error

    php上传大文件报错Internal Server Error,导致文件上传失败。接下来我们就解决这个问题。Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server ...

    721年前
  • file_get_contents函数判断链接是否失效

    在nginx环境中无法使用get_headers函数方法,所以我的站长站这次分享的是用php的file_get_contents函数来判断链接是否失效。原理就是通过file_get_contents函数远程访问链接,判断返回的$http_response_header的HTTP 标头。file_get_contents代码如下:fu...