一定要在文件前面放一个斜线才正确,如下所示:
include __DIR__.'/config.php'; //正确
include __DIR__.'config.php'; //不放斜线,错误
include __DIR__.'./config.php'; //放点斜线,错误
------------------------------------- 以下内容补充于 2016-11-30 04:49:42 -------------------------------------
...
输入文字时出现的下拉提示遮挡视线
解决办法:
找到 libraries/navigation/NavigationTree.php 第 1394 行左右,把
$retval .= " name='searchClause2'";
替换为
$retval .= " name='searchClause2' autocomplete='off' ";
效果如下:
目前感觉手感最好的
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 simultaneous requests that will be
; served. Equivalent...
function getSign($array)
{
$pay_key = "xxxxxxxxxxxxxxxxxxxxxxxx";
unset($array['sign']);
ksort($array);
$stringA = urldecode(http_build_query($array));
$stringSignTemp="$stringA&key=".$pay_key;
return strtoupper(md5($stringSignTemp));
}
function xmlToArray($xml)
{
libxml_disable_entity_loader(true);
$xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
$val = json_decode(json_encode($xmlstring), true);
return $val;
}
function arrayToXml($arr)
{
$xml = "<xml>";
foreach ($arr as $key => $v...
preg_split("/(\".*?\")/is", "good\n$str=\"字符串\";bye", -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
这样分割出来数组是:
=> [
"""
good\n
=
""",
""字符串"",
";bye",
]
然后根据是不是引号"开头,如果是引号开头,则视为字符串
分类表必须有三个字段:id, parent_id, name
function make_tree($arr){
if(!function_exists('make_tree1')){
function make_tree1($arr, $parent_id=0){
$new_arr = array();
foreach($arr as $k=>$v){
if($v->parent_id == $parent_id){
$new_arr[] = $v;
unset($arr[$k]);
}
}
...
php没有内置相关函数,可以自己定义函数实现。
1、最直观最容易理解的方法:
<?php
$a1 = [1,2,3,4,5];
$a2 = [2,4,6];
function array_minus($a1, $a2)
{
$new_a = [];
foreach ($a1 as $e) {
if (!in_array($e, $a2)) {
$new_a[] = $e;
}
}
return $new_a;
}
print_r(array_minus($a1, $a2));
2、用差集和交集实现:
<?...
composer安装方式:
composer global require psy/psysh:@stable
github:https://github.com/bobthecow/psysh
主页:http://psysh.org/
foreach ($forumlist as &$forum) {
$forum['lastpost'] = 'xxx';
}
unset($forum);
否则最后两个$forum会相同
从网上搜到的都是 iconv("GBK","UTF-8//IGNORE",$str); ,把GBK转为UTF-8,可我的情况明明都是UTF-8编码的,用了前面的方法就乱码了。试着用了一下:
$str = iconv("UTF-8","UTF-8//IGNORE",$str);
UTF-8 转为 UTF-8 竟然可以了,我也搞不懂是什么原因,以后遇到类似问题就用这个方法试试。
在PHP中,有时候我们不想直接输出HTML代码,而是把这些html代码放到一个字符串中。可以用缓冲实现。
<?
ob_start();
?>
<div>这些内容将返回到字符串中</div>
<?
$str = ob_get_clean();
?>
比如
$html = file_get_html($url);
$title = $html->find("td.main table.box table.title_info h1", 0);
print_r($title->innertext);
直接上链接吧 http://stackoverflow.com/questions/16712626/hide-intellij-idea-yellow-light-bulb
windows系统大概在这个位置 C:\Users\Administrator\.WebIde80\config\options\editor.xml
修改内容如下:
<application>
<component name="EditorSettings">
<option name="IS_CARET_BLIN...
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-thread-safety --with...
保存以备后用
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
The php.ini file can be found in:
/usr/local/et...
打开 C:\xampp\apache\conf\httpd.conf
把
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
改为
DocumentRoot "C:/"
<Directory "C:/">
smtp.php
<?php
class smtp
{
var $smtp_port;
var $time_out;
var $host_name;
var $log_file;
var $relay_host;
var $debug;
var $auth;
var $user;
var $pass;
var $sock;
function smtp($relay_host = "", $smtp_port = 25,$auth = false,$user,$pass)
{
$this->debug = F...
使用mcrypt对cookie值进行可逆加密,浏览器端存储的是加密过得值,可以当session用。
//配置部分
$config['cookie_prefix'] = 'bccn_';
$config['cookie_domain'] = 'bccn.net';
$config['cookie_path'] = '/';
$config['cookie_skey'] = 'jewhdfy234957632946w32trweyugtfrhsdgfa';
//实现函数部分
function set_cookie($key, $value, $e...
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/libmemcached/+download
cd; \
wget http...