随笔分类 - PHP
摘要:php 生成 Json 部分 <?php $arr_result = array(); //返回值 $arr_result['result'] = '0'; $arr_result['callerid'] = '139411288888'; echo json_encode($arr_result)
阅读全文
摘要:<?php header("Content-Type: application/msword"); header("Content-Disposition: attachment; filename=doc.doc"); //指定文件名称 header("Pragma: no-cache");hea
阅读全文
摘要:$str="中国、美国、俄罗斯、德国、"$str=substr($str,0,-1);输出结果为:中国、美国、俄罗斯、德国
阅读全文
摘要:$t=1637544;$d=Sec2Time($t);$d为 0年18天 22小时52分24秒//将秒数转换为时间(年、天、小时、分、秒)function Sec2Time($time){ if(is_numeric($time)){ $value = array( "year...
阅读全文
摘要://上一个月的今天格式为 "2014-09-23 10:05:09"$forward_month= GetMonth($sign="-1");//得到当前月的下一个月或上一个月的今天 function GetMonth($sign="-1") { //得到系统的日 $day_now=date("d"...
阅读全文
摘要:在PHP中进行GB2312与UTF-8的互换。GB2312--UTF-8iconv("GB2312","UTF-8",$text)UTF-8--GB2312iconv("UTF-8","GB2312",$text)conv函数把抓取来过的utf-8编码的页面转成gb2312,发现用iconv函数把抓取过来的数据一转码数据就会无缘无故的少一些。网上一查资料才知道这是iconv函数的一个bug。iconv在转换字符"—"到gb2312时会出错解决方法很简单,就是在需要转成的编码后加 "//
阅读全文
摘要:安装eaccelerator后的PHP 运行速度提高5-10倍,服务器资源(cpu/内存等)占用减少30-60% 安装步骤:1、把 DLL文件放入 php\ext 下2、php安装目录下 新建 temp 文件夹 设置可写入权限3、php.ini 最后结尾部分加入以下代码 [eaccelerator]
阅读全文
摘要:php 动态生成多选按钮<?phpfunction generate_checkboxes($name,$options, $default=array()) { if (!is_array($default)){ $default = array(); } foreach($options as $value => $label) { $html .= "<input type=checkbox "; if (in_array($value, $default)){ $html .= "checked "; } $html .= &q
阅读全文
摘要:Xdebug 使用说明先说下配置方法:1 下载xdebug http://www.xdebug.org 下载wincachegrind: http://sourceforge.net/projects/wincachegrind/ wincachegridd:为xdebug输出文件分析工具2 把xdebug copy到php扩展文件目录:d:/wamp/bin/php/php5.2.5/ext/编辑php.ini ,在其中添加如下配置行:Php代码 zend_extension_ts="d:/wamp/bin/php/php5.2.5/ext/xdebug.dll" ;;;
阅读全文
摘要:<?php $aera_p="上海,海南,北京,重庆,四川";$aa=explode(",",$aera_p); //explode() 函数把字符串分割为数组//$aa=split("[,]",$aera_p); //截取以","为准的字符串,slipt为用正则表达式判断$BRCount = substr_count($aera_p, ','); //计算","为多少个for($i=0;$...
阅读全文
摘要:php 获取系统时间<?php echo date("Y-m-d h:i:s"); ?><?php date_default_timezone_set('Asia/Chongqing'); //系统时间差8小时问题$now = getdate(time()); $cur_wday=$now['wday'];$date = date("Y-m-d H:i:s $cweekday[$...
阅读全文
摘要:switch 语句:switch ($label){case "个人信息": continue; break;case "同事":continue; break;case "系统管理":continue;break;}foreach 语句:foreach ($attributevalue as $label => $url) {$xtpl->assign("GCL_LABEL", $l...
阅读全文
摘要:<?php $FileID=date("Ymd-His") . '-' . rand(100,999); //$FileID为 20100903-132121-908 这样的的随机数?><?phpfunction randomkeys($length){$pattern='1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLOMNO...
阅读全文
摘要:$bean->StopTime=date("Y-m-d H:i:s");// 当前时间$one = strtotime($bean->StartTime);$tow = strtotime($bean->StopTime);$len = $tow - $one; //得出时间戳差值$bean->TimeLen=$len; //时间差 秒date_default_timezo...
阅读全文
摘要:在下面文件中libraries/select_lang.lib.php 1、找到有"zh-gb2312"的那一行,把'zh-gb2312' 改成 'zh-gb2312-utf-8' 为什么这样加?那是因为服务器会把没有"-utf-8"的语言过滤掉,在libraries/database_interface.lib.php 第168行,根据英文说:“为了防止混淆”,或者如...
阅读全文
摘要:一、重启mysql服务 在开始运行窗口输入如下命令 关闭mysql服务 net stop mysql 起动mysql服务 net start mysql二、MySQL 数据库文件的默认路径 在my.ini文件中 datadir="f:/lamp/MySQL Server 5.1/Data/"三、Appache web根目录的默认路径 在httpd.conf文件中 <Di...
阅读全文
摘要:1.logo图片 \themes\ClassicSugar\images\company_logo.png2.登陆图片\images\middle-bg.gif3.默认主题\config.php'default_theme' => 'ClassicSugar'4.不显示选择主题\login.php位置:<td align=right>主题:</td><td>...
阅读全文
摘要:libraries/select_lang.lib.php 1、找到有"zh-gb2312"的那一行,把'zh-gb2312' 改成 'zh-gb2312-utf-8'2、找到"$mysql_charset_map = array("那一行 把'gb2312' => 'gb2312', 改成 'gb2312' => 'latin1', 并将所有'latin1'注释掉 保存,OK...
阅读全文
摘要:winXP 默认情况下是不搜索 扩展名为php的文件中的内容解决方案:创建一个*.reg文件。用文本打开将下面代码粘贴至其中,保存后执行即可。Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\.php\PersistentHandler]@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
阅读全文
摘要:一.下载相关软件 软件 下载地址httpd-2.2.15-win32-x86-no_ssl.msi http://httpd.apache.org/download.cgimysql-5.1.46-win32.msi http://dev.mysql.com/downloads/php-5.2.13-Win32.zip http://www.php.net/downloads.phpphpMyAd...
阅读全文