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 
相关文档:
VC6是什么?
VC6就是legacy Visual
Studio 6 compiler,就是使用这个编译器编译的
VC9是什么?
VC9就是the Visual Studio
2008 compiler,就是用微软的VS编辑器编译的
那我们如何选择下载哪个版本的PHP呢?
如果你是在windows下
使用Apache+PHP的,请选择VC6版本;
如果你是在windows下使用IIS+PHP的,请选择VC9 ......
<?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=../"); ......