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 
相关文档:
伪静态用到知识很简单一旦学会,快乐无穷,只需要正则和服务器设置。
先说iis如何设置吧,往下看
下载(IIS Rewrite模块): http://www.isapirewrite.com/,先把产品下载下来,安装在服务器上,记住目录,会有类似Rewrite.dll的文件生成,MMC→IIS信息服务管理器→网站→您的站点→属性,在“ ......
<?php
//״ͼ
//http://www.codefans.net
//
function createImage($data,$twidth,$tspace,$height){
$dataName = array();
&nb ......
今天遇到了一个怪问题,我用$fp=fopen("access_log.txt","ab")打开一个文件后开始往里面写数据,写的内容是 'XXX\nXXX\n';
但是奇怪的是 不管我怎么往里面写 他是不换行,记事本里记录的数据 就是 'xxx\nxxx\n',
很是恼火,去网上搜集资料,有的说改成'\r\n'什么的,结果是写进去后还是 'xxx\r\nxx ......
安装以及配置
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 ......
<?php
//作者:梁文平 http://www.tyasp.net
session_start();
if($_SESSION["username"]!="admin")
{
echo("<mce:script type="text/javascript"><!--
alert("操作超时!请重新登陆...");window.location.href="../index.php";
// --></mce:script>");
//header("refresh:0;url=../"); ......