随笔分类 - PHP
1
摘要:./configure --prefix=/usr/local/php7 \ --with-curl \ --with-freetype-dir \ --with-gd \ --with-gettext \ --with-iconv-dir \ --with-kerberos \ --with-li
阅读全文
摘要:start(); * ======================== * 当然,如果你喜欢,还可以对此类进行扩展, * 比如,如果需要用户登录才能采集的数据怎么办? * 只要我们使用 curl 来做伪登录,把 cookie 保存到文件, * 每次请求发送有效的 cookie 即可实现伪登录抓去数据! */ class MultiHttpRequest { public $u...
阅读全文
摘要:有时我们很多栏目公用一个模版,但栏目展示的图片又不同,并且要考虑到多级栏目下的 {dede:field.typeid function="GetTopid(@me)"/} 这个能获取到栏目的顶级ID,不同的栏目图片加上不同的ID就可以了。
阅读全文
摘要:今天无意间看ECSHOP的源码,看到获取中文字符串的长度的代码,感觉这个思路很不错。
阅读全文
摘要:function getFirstLetter($str){ $fchar = ord($str{0}); if($fchar >= ord("A") and $fchar = -20319 and $asc = -20283 and $asc = -19775 and $asc = -19218 and $asc = -18710 and $asc = -18526 and $...
阅读全文
摘要:function defend_sql($string, $force = 1) { $preg = "select|insert|and|or|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile"; if(!get_magic_quotes_gpc() || $force) { if...
阅读全文
摘要:可用于数据操作,防止超时。
阅读全文
摘要:/** * 判断url是否存在 */ function is_url_exist($url) { $array = get_headers($url, 1); if (preg_match('/200/', $array[0])) { return true; } else { return false; } }
阅读全文
摘要:需要安装扩展shmop 找到php安装源文件目录 编译安装成功 多出一个 shmop.so 在php.ini增加shmop.so extension=shmop.so
阅读全文
摘要:text = ! isset ( $showText ) ? $showText : $this->text; $this->show (); } function createText($instring) { $outstring = ""; $max = strlen ( $instring ); for($i = 0; $i = 160 && $i createTex...
阅读全文
摘要:SimpleXML操作简要总结 simplexml_load_file() 从 XML 文档获取 SimpleXMLElement 对象。 5 simplexml_load_string() 从 XML 字符串获取 SimpleXMLElement 对象。 simplexml_import_dom(
阅读全文
摘要:在Linux下安装PHP,源代码方式安装,总需要配置很多参数。这里列出常用配置参数,并详细用中文解释说明了。 给大家一些参考./configure --prefix=/usr/local/PHP php 安装目录 --with-apxs2=/usr/local/apache/bin/apxs --w
阅读全文
摘要:'; $zero=''; }else{ $r= $n2s[intval($s2{$i})].$unit[$i%4].$r; } } //处理前面的0 $zPos=strpos($r,'零'); if($zPos==0 && $zPos!==false) $r=substr($r,2,strlen($r)-2); return $r;...
阅读全文
摘要:转载自http://www.phpchina.com/index.php?action-viewthread-tid-5728
阅读全文
摘要:function pc_grid_horizontal($array, $size) { $table_width = 100; $width = intval($table_width / $size); $tr = ''; $td = "%s"; $grid = "$tr"; $i = 0; foreach ($array as $e) { $grid .= s...
阅读全文
摘要:$now = time(); $today = getdate(); $start_day = getdate($now - $today['yday'] * 3600 * 24);//获取今年第一天的时间戳 $first_sunday = $now - ($today['yday'] - (7 - $start_day['wday'])) * 3600 ...
阅读全文
摘要:3+8+9 [1] => 4+7+9 测试效果:1:对于加数数组比较小的,速度可以,过大的话,有些慢;2:每次可以使用不同的加数的,处理会变慢 采用的方法是:生成所有可能排列,对排列处理过滤重复的,得到组合 */ function huoqu_zhuhe($total, $num_array, $count = 0, $isone = 1){ if(empty($num_ar...
阅读全文
摘要:function traverse_scandir($dir) { $files = array(); if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file !="..") { ...
阅读全文
摘要:function direct_sort($data) { $count = count($data); if($count == 0) return; elseif($count == 1) return $data; for($i = 0; $i $data[$j]) { $temp =...
阅读全文
1

浙公网安备 33010602011771号