代码改变世界

推荐排行榜

php中$_REQUEST一个注意点

2012-10-12 11:02 by 轩脉刃, 7915 阅读, 收藏,
摘要: 问题 说起$_REQUEST,大家都知道的是它是$_GET和$_POST的集合。但是如果你有心的话,查一下文档,会看到: $_REQUEST An associative array that by default contains the contents of $_GET, $_POST and $_COOKIE. 这里说$_REQUEST默认是$_GET, $_POST, $_COO... 阅读全文

说说PHP的autoLoad

2012-09-27 11:04 by 轩脉刃, 4966 阅读, 收藏,
摘要: php的autoload大致可以使用两种方法:__autoload和spl方法。这两种方法又各有不同的几种使用方法。 __autoload的使用方法1: 最经常使用的就是这种方法,根据类名,找出类文件,然后require_one function __autoload($class_name) { $path = str_replace('_', '/', $class_name); require $path . '.php';}// 这里会自动加载Http/File/Interface.php 文件$a = new Http_File_Int 阅读全文

Zend的Captcha机制

2012-08-13 18:31 by 轩脉刃, 2268 阅读, 收藏,
摘要: 如何生成验证码图片?使用php的GD? ok,right。其实Zend的Captcha模块已经封装好了。这篇文章就说一下如何使用Zend的Captcha模块。 环境安装 首先Zend的Captcha需要安装GD。查看有没有安装GD需要去phpinfo()中看是否有GD模块。(注意,有可能出现php -m里面的模块有gd但phpInfo()里面的模块没有gd,这个问题是说明你的PHP和Ap... 阅读全文

Zend的Registry机制

2012-08-03 10:02 by 轩脉刃, 2890 阅读, 收藏,
摘要: 项目过程中有很多全局变量, 需要全局存储,是否是使用全局变量来进行存储?那就弱爆了。Zend使用Registry机制(注册表)存储对象和值,是一个存储对象和值的容器。 Zend_Registry这个类就是做这个目的 代码示例 Zend_Registry::set('config', $config); Zend_Registry::get('config'); 代码分析 这两... 阅读全文

Zend的Config机制

2012-08-02 13:04 by 轩脉刃, 1654 阅读, 收藏,
摘要: Zend的Config类在Zend_Config_Ini 代码 $config = new Zend_Config_Ini("/var/www/html/usvn/config/config.ini", "general"); date_default_timezone_set($config->timezone); USVN_ConsoleUtils::setLocale($config->system->locale); === Config.ini文件内容 [general] url.base = "/usvn" 阅读全文