随笔分类 -  PHP

php函数,php技巧
摘要:你是否曾经对一些网站的网址看起来非常清爽,没有任何.php或.html后缀感到奇怪?他们就是这样做到的。1、安装 mod_rewrite 模块 因为 Apache 服务器默认是没有打开 mod_rewrite 模块的,所以我们必须手动来启动。打开 Apache 的配置文件 httpd.conf 文件,找到下面一行: #LoadModule rewrite_module modules/mod_rewrite.so 前面的 # 号是 Apache 配置文件的注释符,也就是 Apache 服务器没有加载该模块。将前面的 # 号去掉,保存后重启 Apache 服务器,这是我们就实现了加载 mod_r 阅读全文
posted @ 2012-11-13 16:35 KoMiles 阅读(24874) 评论(0) 推荐(1)
摘要:php页面中有时候想改时区,最简单的办法是在程序的上面加上这样一句话:date_default_timezone_set('PRC'); 阅读全文
posted @ 2012-10-30 19:22 KoMiles 阅读(553) 评论(0) 推荐(0)
摘要:最近想用php把自己的数据保存起来,并且是excel格式。可以按一下方法:第一步:写一个类文件(php-excel.class.php)View Code <?php/** * Simple excel generating from PHP5 * * @package Utilities * @license http://www.opensource.org/licenses/mit-license.php * @author Oliver Schwarz <oliver.schwarz@gmail.com> * @version 1.0 *//** * Generati 阅读全文
posted @ 2012-10-26 18:25 KoMiles 阅读(765) 评论(0) 推荐(0)
摘要:今天在网上看到一个很好用分页类,特地保存下来,留着以后用。View Code each_disNums=intval($each_disNums); $this->nums=intval($nums); if(!$current_page){ $this->current... 阅读全文
posted @ 2012-10-16 19:47 KoMiles 阅读(287) 评论(0) 推荐(0)
摘要:今天在写程序时,遇到页面跳转问题,总结下来,方便以后查看:1.header函数实现跳转<?phpheader("Location:jump.php");//重定向浏览器exit(); //确保重定向后后面的代码不会执行?>注意一下三个方面:1.location和“:”号间不能有空格,否则不会跳转。 2.在用header前不能有任何的输出。 3.header后的PHP代码还会被执行。2.meta标签<?php $url = "http://www.baidu.com"; ?> <html> <head> &l 阅读全文
posted @ 2012-10-15 19:36 KoMiles 阅读(949) 评论(0) 推荐(0)
摘要:今天想做一个网站上的关键字在百度搜索中的排名。效果如图:功能很简单,输入关键字,输入域名,点击搜索,就会出现下图:现在把代码贴出来,希望可以帮助到好学的朋友。View Code <?php function search($keyword,$url,$page = 1){ static $px = 0; $rsState = false; $enKeyword = urlencode($keyword); $firstRow = ($page - 1) * 10; if(... 阅读全文
posted @ 2012-10-10 19:15 KoMiles 阅读(637) 评论(0) 推荐(0)