摘要: <?php $ctx = stream_context_create(array( 'http' => array( 'timeout' => 1 //设置一个超时时间,单位为秒 ) ) ); file_get_contents("http://example.com/", 0, $ctx); ?> 设置一个超时时间就可以,可以自行封装函数 阅读全文
posted @ 2012-07-25 10:34 Falling Leaves 阅读(443) 评论(0) 推荐(0) 编辑
摘要: //定义一个学生数组$students = array( 256=>array('name'=>'jon','grade'=>98.5), 2=>array('name'=>'vance','grade'=>85.1), 9=>array('name'=>'stephen','grade'=>94.0), 364=>array('name'=>'steve' 阅读全文
posted @ 2012-07-12 16:15 Falling Leaves 阅读(1571) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-07-10 10:46 Falling Leaves 阅读(584) 评论(0) 推荐(0) 编辑
摘要: mysql服务器的主从配置,本来是一件很简单的事情,无奈不是从零开始,总是在别人已经安装好的mysql服务器之上 ,这就会牵扯到,mysql的版本,启动文件,等一些问题。不过没关系,先问清楚两点1、mysql配置文件my.cnf的位置2、如何启动、停止mysql,找好启动文件假设有两台机器,已经安装好了mysql(尽量同版本,且两台机器同一网络,可以ping通)有朋友说:“从服务器,不能低于主服务器的版本”,不过我是低于的,没有出现问题。主机A: 192.168.1.100从机B:192.168.1.101可以有多台从机1、先登录主机 Amysql>GRANTREPLICATION SL 阅读全文
posted @ 2012-06-15 09:56 Falling Leaves 阅读(292) 评论(0) 推荐(0) 编辑
摘要: Php Jquery Load FadeIn FadeOut 无刷新分页index.php<?phpdefine('IN_LOVE',true);require_once('includes/load.php');$smarty->display('index.html');?>index.html<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 阅读全文
posted @ 2012-06-14 12:14 Falling Leaves 阅读(1218) 评论(0) 推荐(0) 编辑
摘要: header("Content-type:text/html;charset=utf-8");$conn = mysql_connect('localhost','root','123456');mysql_select_db('test');mysql_query("set names 'utf8'");function getCate($pid = 0){ $sql = "select * from cate where pid=".$pid; $re 阅读全文
posted @ 2012-05-24 11:51 Falling Leaves 阅读(1352) 评论(0) 推荐(0) 编辑
摘要: jquert.html 页面<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html 阅读全文
posted @ 2012-05-21 16:50 Falling Leaves 阅读(1763) 评论(0) 推荐(0) 编辑
摘要: json.html 代码<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>PHP Json传输数据</title></head> <script type="text/javascript" src="js/jquery.js"></script> <script type="text 阅读全文
posted @ 2012-05-18 17:25 Falling Leaves 阅读(5468) 评论(1) 推荐(1) 编辑
摘要: Query的选择器之强大是有目共睹的,phpQuery让php也拥有了这样的能力,它就相当于服务端的jQuery。先来看看官方简介:phpQuery is a server-side, chainable, CSS3 selector driven Document Object Model (DOM) API based on jQuery JavaScript Library.Library is written in PHP5 and provides additional Command Line Interface (CLI).存在的意义我们有时需要抓取一个网页的内容,但只需要特定部 阅读全文
posted @ 2012-04-11 17:12 Falling Leaves 阅读(42622) 评论(1) 推荐(4) 编辑
摘要: 前段时间做了一个php负载均衡试验,上网找了好的资料,不过中文资料实在是匮乏,好不容易找到的还存在很多问题,为了下次用到的时候少走弯路,做个笔记,记录一下。试验中前端为Nginx,Lighttpd下也可以,可以根据需要调整。具体情况如下:服务器三台,都具有两块网卡,分别为A、B、C,内网IP地址分别是192.168.0.1,192.168.0.2,192.168.0.3。A运行Nginx作为前端,B、C主要分担运算压力。数据库部分不予考虑。系统: CentOS 5.5 64位Nginx:0.6以后的所有版本都适用。PHP: 版本5.2.14,使用同一份编译,分别复制到每台服务器上。网站目录:/ 阅读全文
posted @ 2012-03-29 10:28 Falling Leaves 阅读(2337) 评论(0) 推荐(0) 编辑