PHP中this self parent三个应用说明
this,self,parent三个关键字之间的区别。从字面上比较好理解,分别是指这、自己、父亲。我们先建立几个概念,这三个关键字分别是用在什么地方呢?我们初步解释一下,this是指向当前对象的指针(姑且用C里面的指针来看吧),self是指向当前类的指针,parent是指向父类的指针。我们这里频繁使用指针来描述,是因为没有更好的语言来表达。
这么说还不能很了解,那我们就根据实际的例子结合来讲讲:
Php代码
(1) this
class UserName
{
//定义属性
private $name;
//定义构造函数
function __construct( $name )
{
$this->name = $name; //这里已经使用了this指针
}
//析构函数
function __destruct(){}
//打印用户名成员函数
function printName()
{
print( $this->name ); //又使用了this指针
}
}
//实例化对象
$nameObject = new UserName( "heiyeluren" );
//执行打印
$nameObject->printName(); //输出: heiyeluren
//第二次实例化对象
$nameObject2 = new UserName( "PHP5" );
//执行打印
相关文档:
转载自:http://www.ibm.com/developerworks/cn/opensource/os-php-5.3unicode/index.html
Web
是一个用来开发全球性应用程序和服务的理想平台。要创建一个真正具有国际魅力的应用程序,必须对它进行调整以便能够以各种语言和编写系统处理和显示数据。
常用缩写词
HTML:
超文本标记语言
HTTP:
超文本传 ......
本文转自我的博客:(my.unix-center.net/~xiaoshe)
http://my.unix-center.net/~xiaoshe/2010/04/19/%E4%B8%80%E4%B8%AA%E8%B6%85%E7%BA%A7%E7%AE%80%E5%8D%95%E7%9A%84php%E6%8A%95%E7%A5%A8%E7%B3%BB%E7%BB%9F%EF%BC%8C%E4%B8%8D%E4%BD%BF%E7%94%A8%E6%95%B0%E6%8D%AE%E5%BA%93/
从网上发现的一个超级简单的基于php的投 ......
一 Apache 的安装
1 Apache 的安装
2 同意协议
3 接着 "Next "
4 填写 域名(network domain) 服务器的名称 (Server Name) 管理者邮箱(Administrator's Email)
5 安装类型
6 选择安装路径
7 点击“install ” 继续
8 开始安装
9 安装结束
二 MySql的安装
......
在javascript代码中用encodeURIComponent()函数处理中文字符串,
JS代码:
<mce:script type=”text/javascript”><!--
string = encodeURIComponent(string);
location.href = index.php?keyword=’+string;
// --></mce:script>
PHP代码:
<?php
$keyword = (isset($_GET ......
用PHP实现手机归属地查询api接口:
主要使用curl实现,需要开启php对curl的支持.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Conten ......