易截截图软件、单文件、免安装、纯绿色、仅160KB

php 构造函数参数

在PHP里,如果你没有手写构造函数,则php在实例化这个对象的时候,会自动为类成员以及类方法进行初始化,分配内存等工作,但是有些时候不能满足我们的要求,比如我们要在对象实例化的时候传递参数,那么就需要手动编写构造函数了,手写构造函数有两种写法,只是表现形式不同,其实本质一样
class test
{
    function __construct()
    {
     //your code
    }
}
class test
{
    function test()//如果方法名跟类名字一样,将被认为是构造函数
    {
    //your code
    }
}
以上为两种基本形式
传递参数进行实例化的例子,简单的写一个参考
class test
{
    public $test = '';
    function __construct($input = '')
    {
        $this->test = $input;
    }
    function getTest()
    {
        return $this->test;
    }
}
$a = new test('a test');
echo $a->getTest()//将输出 a test
$b = new test();
echo $a->getTest()//没有任何输出(其实是有输出,但是输出为空)


相关文档:

Run PHP on the Google App Engine

Google launched their Google App Engine (GAE) a year ago. The free hosting in App Engine is allocated 500 MB of persistent storage and enough CPU and bandwidth for about 5 million page views a month. Also, if you really want more you can see pricing plans.
GAE will support Java going forw ......

linux下安装PHP APACHE MYSQL 手记

/**********************************
APACHE
***********************************/
编辑参数:
./configure" \
"--prefix=/usr/local/apache" \
"--enable-so" \
"--enable-ssl" \
"--enable-mods-shared=most" \
"--with-mpm=event" \
"--with-ssl=/usr/local/openssl" \
"--enable-cache" \
"--enable-mem- ......

PHP源代码简单分析

PHP源代码简单分析
1. 目录结构
   1. build 和编译有关的目录。
   2. ext 扩展库代码,例如 Mysql、zlib、iconv 等我们熟悉的扩展库。
   3. main 主目录。
   4. sapi 和各种服务器的接口调用,例如apache、IIS等,也包含一般的fastcgi、cgi等。
   5. wi ......

php配置文件详解

[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini   ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The follo ......

PHP+MySQL乱码的解决

在DOS中进行MySQL的访问可能乱码的情况有三种,
    首先,要做的是检查MySQL的配置,安装的时候选择utf-8的语言环境会省去很多的麻烦
1. 检查MySQL的服务端、客户端的语言设置是否为“utf8”,不是的话手动将my.int更改过来;
2. 在PHP进行第一次mysql_query之前设置使用连接的字符集为"SET N ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号