PHP用__DIR__的注意事项(坑)

一定要在文件前面放一个斜线才正确,如下所示: include DIR.'/config.php';    //正确 include DIR.'<span style="c...
2016-11-23 01:56 | 12946次阅读 | 0评

phpmyadmin搜索表名称时,去掉下拉提示的解决办法

输入文字时出现的下拉提示遮挡视线 解决办法: 找到 libraries/navigation/NavigationTree.php 第 1394 行左右,把 $retval .= " name='searchClause2'"; 替换为 $retval .= " name...
2016-11-11 22:04 | 1536次阅读 | 0评

php-fpm.conf最佳体验参数

目前感觉手感最好的 pm = dynamic ; The number of child processes to be created when pm is set to 'static' and the ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. ; This value sets the limit on the number of simultaneou...
2016-10-29 19:21 | 1277次阅读 | 0评

php计算微信支付的sign值,不用手工拼接参数了。

function getSign($array) { $paykey = "xxxxxxxxxxxxxxxxxxxxxxxx"; unset($array['sign']); ksort($array); $stringA = urldecode(httpbuildquery($array)); $stringSignTemp="$stringA&key=".$paykey; return strtoupper(md5($stringSignTemp)); }
2016-08-25 23:55 | 2765次阅读 | 0评

php 数组和xml互相转换

function xmlToArray($xml) { libxmldisableentityloader(true); $xmlstring = simplexmlloadstring($xml, 'SimpleXMLElement', LIBXMLNOCDATA); $val = jsondecode(jsonencode($xmlstring), true); return $val; } function arrayToXml($arr) { $xml = "&lt...
2016-08-25 23:48 | 1857次阅读 | 0评

PHP实现编译器思路,使用preg_split分割字符串和注释

pregsplit("/(\".*?\")/is", "good\n$str=\"字符串\";bye", -1, PREGSPLITDELIMCAPTURE | PREGSPLITNO_EMPTY); 这样分割出来数组是: => [ """ good\n = """, ""字符串"", ";bye", ...
2016-08-19 15:14 | 1733次阅读 | 1评

php实现无限级分类及下拉菜单树形效果。

分类表必须有三个字段:id, parentid, name function maketree($arr){ if(!functionexists('maketree1')){ function maketree1($arr, $parentid=0){ $newarr = array(); foreach($arr as $k=>$v){ if($v->parentid == $parent_id){ $ne...
2016-06-04 10:10 | 23979次阅读 | 1评

PHP数组相减

php没有内置相关函数,可以自己定义函数实现。 1、最直观最容易理解的方法: <?php $a1 = [1,2,3,4,5]; $a2 = [2,4,6]; function arrayminus($a1, $a2) { $newa = []; foreach ($a1 as $e) { if (!inarray($e, $a2)) { $newa[] = $e; } } return $new_a; } ...
2016-04-07 09:39 | 12645次阅读 | 0评

python有ipython,ruby有pry,php有psysh

composer安装方式: composer global require psy/psysh:@stable github:<a href="https://github.com/bo...
2016-02-19 00:56 | 12131次阅读 | 0评

php的foreach引用传递后需要unset

foreach ($forumlist as &$forum) { $forum['lastpost'] = 'xxx'; } unset($forum); 否则最后两个$forum会相同
2016-02-07 00:22 | 12291次阅读 | 0评

php用json_encode输出为空的一个解决办法

从网上搜到的都是 iconv("GBK","UTF-8//IGNORE",$str); ,把GBK转为UTF-8,可我的情况明明都是UTF-8编码的,用了前面的方法就乱码了。试着用了一下: $str = iconv("UTF-8","UTF-8//IGNORE",$str)...
2015-04-07 17:37 | 5345次阅读 | 0评

PHP中穿插的html代码返回到字符串

在PHP中,有时候我们不想直接输出HTML代码,而是把这些html代码放到一个字符串中。可以用缓冲实现。 <? obstart(); ?> <div>这些内容将返回到字符串中</div> <? $str = obget_clean(); ?>
2015-03-31 09:11 | 2087次阅读 | 1评

php的simple_html_dom获取元素的html内容采用innertext

比如 $html = file...
2015-03-02 13:28 | 5367次阅读 | 0评

phpstorm去掉烦人的黄色小灯泡

直接上链接吧 http://stackoverflow.com/questions/16712626/hide-intellij-idea-yellow-light-bulb windows系统大概在这个位置 C:\Users\Administrator.WebIde80\config\options\editor.xml 修改内容如下: <application><...
2015-02-04 11:16 | 5796次阅读 | 0评

homebrew安装php的配置参数

brew tap homebrew/dupes brew tap josegonzalez/homebrew-php brew install php56 --with-debug --with-fpm --with-gmp --with-homebrew-curl --with-homebrew-libxslt --with-homebrew-openssl --with-imap --with-libmysql --with-mssql --with-phpdbg --with-postgresql --with-thr...
2015-01-17 22:18 | 3103次阅读 | 0评

homebrew安装php5.6后的信息

保存以备后用 ==> Caveats To enable PHP in Apache add the following to httpd.conf and restart Apache: <p style="...
2015-01-17 20:49 | 5768次阅读 | 0评

xampp修改htdocs目录为C盘

打开 C:\xampp\apache\conf\httpd.conf 把 DocumentRoot "C:/xampp/htdocs" <Directory "C:/xampp/htdocs">        改为 DocumentRoot "C:/" <Directory "C:/">...
2014-06-24 14:06 | 1682次阅读 | 0评

php通过smtp协议发送email

smtp.php <?php class smtp { var $smtpport; var $timeout; var $hostname; var $logfile; var $relay_host; var $debug; var $auth; var $user; var $pass; var $sock; function smtp($relay_host = "", $smtp_port = 25,$...
2014-04-14 17:58 | 1090次阅读 | 0评

自己封装的加密cookie相关函数

使用mcrypt对cookie值进行可逆加密,浏览器端存储的是加密过得值,可以当session用。 //配置部分 $config['cookieprefix'] = 'bccn'; $config['cookiedomain'] = 'bccn.net'; $config['cookiepath'] = '/'; $config['cookie_skey'] = 'jewhdfy234957632946w32trweyugtfrh...
2014-04-11 17:02 | 1384次阅读 | 0评

centos安装php的memcached扩展

yum install ntsysv mysql mysql-server git-core gcc gcc-c++ libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel openssl openssl-devel pcre-devel libevent 先安装libmemcached https://launchpad.net/libme...
2014-03-21 14:21 | 5725次阅读 | 0评
浏览1528974次
最新评论