随笔分类 -  PHP

PHP是一种通用开源脚本语言。语法吸收了C语言、Java和Perl的特点,利于学习,使用广泛,主要适用于Web开发领域。
摘要:phar文件可以把用到的PHP文件全部打包在一个文件中,十分方便网站部署。但是单个的PHP文件可以使用opcache缓存(字节码缓存),以提升PHP的运行速度。那么PHAR文件包如何使用缓存呢。 这里需要进行配置(php.ini) phar.cache_list 手册上的解释为: Allows ma 阅读全文
posted @ 2019-11-25 11:02 osfipin 阅读(453) 评论(0) 推荐(0) 编辑
摘要:测试in_array、isset、array_key_exists性能。自己写的简易测试代码: 我的电脑中输出的结果: 0.01480007秒 328字节0.00003886秒 328字节0.00008416秒 328字节 粗率来看使用isset最好,in_array比array_key_exist 阅读全文
posted @ 2017-09-22 14:29 osfipin 阅读(538) 评论(0) 推荐(0) 编辑
摘要:有时候为了解决BUG,需要测试一些函数或代码最终实现的效果,来排除一些影响因素。这时候需要把代码单独拎出来,放在一个php单文件中来测试。在头部最好加上三句代码如下: 第一句:显示错误。 第二句:设置应该报告所有 PHP 错误。 第三句:设置默认时区 中国。 自己常用的 测试用的一些函数: 阅读全文
posted @ 2017-06-09 15:43 osfipin 阅读(176) 评论(0) 推荐(0) 编辑
摘要:nilcms中:php简易配置函数。 文件位置:nc-admin/common.php 值存储在对象中,利于使用C()直接调用原值。nilcms go!!! 阅读全文
posted @ 2017-03-13 11:07 osfipin 阅读(262) 评论(0) 推荐(0) 编辑
摘要:生成随机密码或盐。 Generate keys and salts using secure CSPRNG 输出结果演示: 如果不是php7也想使用random_int(可以产生更高质量的随机数)函数,可以使用 Paragon Initiative 公司的 random_compat 库。 阅读全文
posted @ 2017-02-08 09:15 osfipin 阅读(646) 评论(0) 推荐(0) 编辑
摘要:php手册 中关于 关于这个情况的解释,可自己搜索。我们可以自己定义一个函数解决这样的问题,实例如下: 其中call_user_func_super就是自定义的 函数,可以使用自定义变量。输出: 当然这里面只使用了一个自定义变量,如果多个,可自行更改就可以了。 阅读全文
posted @ 2016-12-15 22:23 osfipin 阅读(1070) 评论(0) 推荐(0) 编辑
摘要:今天在测试nilcms系统的时候,出现了一个报错,导致缓存无法更新: file_put_contents(C:\UPUPW_AP5.4\vhosts\d.tv\NilCMS_APP\include_run/config_site.php): failed to open stream: Invali 阅读全文
posted @ 2016-05-24 16:40 osfipin 阅读(1776) 评论(0) 推荐(0) 编辑
摘要:运行环境:PHP 5.5.30-x64,MYSQL5.6.27错误代码:Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alterna... 阅读全文
posted @ 2015-10-31 10:58 osfipin 阅读(1853) 评论(0) 推荐(0) 编辑
摘要:版本维护:5.2:维护至:2011-01-06。支持:xp(2003)以上。最终版本:5.2.17。5.3:维护至:2014-08-14。支持:xp(2003)以上。最终版本:5.3.295.4:维护至:2015-09-14。支持:xp(2003)以上。最终版本:5.4.455.5:维护至:2016... 阅读全文
posted @ 2015-09-20 14:08 osfipin 阅读(583) 评论(0) 推荐(0) 编辑
摘要:某些情况下 隐藏路径信息 使用伪静态定义:RewriteRule ^no/torrent(.*)$ /index.php/torrent/doit/$1CodeIgniter会自动识别到 no 控制器,但是我其实想识别到torrent 控制器需要对core\URI.php 文件进行处理下 /** ... 阅读全文
posted @ 2015-06-03 12:34 osfipin 阅读(293) 评论(0) 推荐(0) 编辑
摘要:PHP清理跨站XSS xss_clean 函数 整理自codeigniter Security由Security Class 改编成函数xss_clean 单文件直接调用。BY吠品。//来自codeigniter 清理跨站XSS xss_clean//Security Class 改编成函数func... 阅读全文
posted @ 2015-02-09 11:57 osfipin 阅读(1599) 评论(0) 推荐(0) 编辑
摘要:ThinkPHP3.2 G函数代码及 使用方法代码:// 内存是否可调用define('MEMORY_LIMIT_ON',function_exists('memory_get_usage'));/** * 记录和统计时间(微秒)和内存使用情况 * 使用方法: * * G('begin'); //... 阅读全文
posted @ 2015-02-08 14:08 osfipin 阅读(2559) 评论(0) 推荐(0) 编辑
摘要:获取数组第一个元素的值,如果是数字索引那还好,直接$array[0],如果键名是字符串,你又未知这个字符串呢?用current()函数就可以做到。current() 函数返回数组中的当前元素(单元)。每个数组中都有一个内部的指针指向它“当前的”元素,初始指向插入到数组中的第一个元素。current(... 阅读全文
posted @ 2015-02-06 13:08 osfipin 阅读(15992) 评论(0) 推荐(0) 编辑
摘要:使用某个PHP代码格式化的工具。源代码:if ($this->_standardize_newlines == TRUE){ if (strpos($str, "\r") !== FALSE) { $str = str_replace(array("\r\n", "\r", "\r\n\n"), ... 阅读全文
posted @ 2015-01-27 09:52 osfipin 阅读(675) 评论(0) 推荐(0) 编辑
摘要:HTML页面中加入代码js.php代码:经常有网站采集cnblog博客里的文章 哈哈哈 阅读全文
posted @ 2014-07-27 16:31 osfipin 阅读(785) 评论(0) 推荐(0) 编辑
摘要:php 过滤英文标点符号 过滤中文标点符号代码 function filter_mark($text){ if(trim($text)=='')return ''; $text=preg_replace("/[[:punct:]\s]/",' ',$text); ... 阅读全文
posted @ 2014-06-12 09:03 osfipin 阅读(1517) 评论(0) 推荐(0) 编辑
摘要:PHP 后台定时循环刷新某个页面如果间隔时间过长的话 会出现apache自动停止的现象。出现的原因则是设置了 ThreadsPerChild 450 MaxConnectionsPerChild 3000错误日志报错[mpm_winnt:notice] [pid 126... 阅读全文
posted @ 2014-04-29 13:02 osfipin 阅读(1160) 评论(0) 推荐(0) 编辑
摘要:php 生成随机字符串可以指定是纯数字 还是纯字母 或者混合的。可以指定长度的。 1 function rand_zifu($what,$number){ 2 $string=''; 3 for($i = 1; $i <= $number; $i++){ 4 //混合... 阅读全文
posted @ 2014-04-17 14:52 osfipin 阅读(968) 评论(0) 推荐(0) 编辑

我是底部
点击右上角即可分享
微信分享提示