PHP中的魔术方法
PHP中有下列称之为魔术方法(magic method)的函数:__construct, __destruct ,
__call, __callStatic,__get, __set, __isset, __unset , __sleep, __wakeup,
__toString, __set_state, __clone and __autoload,本文使用__call为实现一个身份验证的简单实例,代码如下: 代码<?php
interface Accountable
{
const ERR_MSG = "error";
public function isLoggedIn();
public function getAccount($user = '');
}
abstract class Authentication implements Accountable
{
private $account = null;
public function getAccount($user = '')
{
if ($this->account != null) {
return $this->account;
} else {
return ERR_MSG;
}
}
public function isLoggedIn()
{
return ($this->account != null);
}
}
class 
相关文档:
一个非常简单的PHP生成缩略图的代码程序,参数及代码都算得上精简,有兴趣的朋友可以试下它的功能,有不太完善的地方还请指正。 非原创,来自网络
<?$FILENAME="image_name";
// 生成图片的宽度
$RESIZEWIDTH=400;
// 生成图片的高度
$RESIZEHEIGHT=400;
function ResizeImage($im,$maxwidth,$maxheight,$name){ ......
in_array(value,array,type) //检查一个值是否在数组中,type可选,设置为true检查类型是否相同,分大小写
例:
$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os)) {
echo "Got Irix";
......
http://www.dedecms.com/knowledge/program/php/2009/0929/51.html
来源:PHP100 作者:PHP100er 发表于:2009-09-29 11:05 点击:
2363
最近学习URL跳转的时候新进三个超好用的PHP加密解密函数,貌似是discuz里的使用这些加密解密的原因是因为有时自己的URL地址被人获取以后想破解你里面传值的内容就必须知道你的key, ......
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 92160 bytes) in :\Inetpub\wwwroot04\test.php on line 8
Fatal error: Out of memory (allocated 259,260,416) (tried to allocate 16 bytes) in C:\Inetpub\wwwroot04\test.php on line 8
//ini_set('memory_limit', '-1');
$inde ......
安装以及配置
1. 安装Apache-2.2.4(Apache_Dir=D:\myspace\Apache-2.2.4)
2. 解压安装PHP-5.2.11(PHP_Dir=D:\myspace\PHP-5.2.11)
3. 找到PHP-5.2.11下的php.ini-dist,改名为php.ini
4. &nb ......