PHP

PHP学习笔记

字符串运算符.
<?php
$a=my;
$b=name;
echo ($a.$b);    #把字符串$a与字符串$b连起来
?>
数组运算符+
+ 运算符把右边的数组附加到左边的数组后面,但是重复的键值不会被覆盖。
<?php
$a = array("a" => "apple", "b" => "banana");
$b = array("a" => "pear", "b" => "strawberry", "c" => "cherry");

$c = $a + $b; // Union of $a and $b
echo "Union of \$a and \$b: \n";
var_dump($c);

$c = $b + $a; // Union of $b and $a
echo "Union of \$b and \$a: \n";
var_dump($c);
?> 

PHP 源码安装

因为PHP需要定制,所以yum安装个人认为比较麻烦,所以跟据自己使用需要用源码包安装

http://www.php.net下载PHP PHP4还是PHP5根据软件需要下载

以下使用PHP 5.2.5 Released安装
tar -jxvf php-5.2.5.tar.bz2
cd php-5.2.5

./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--enable-mbstring --with-zlib --with-gd \
--with-jpeg-dir=/usr/local/lib --with-png-dir \
--with-mysql --with-mcrypt  --with-xsl --with-gettext\
--with-mysql-sock --with-ldap --with-mhash \
--with-imap --with-kerberos --with-imap-ssl

安装时所需支持依赖包,可以通过yum安装

make && make install
cp php.ini-dist /usr/local/lib/php.ini
安装后可以通过下面的代码测试PHP显示的相关信息
<?php phpinfo(); ?>
/home/yepnnet/public_html/wiki/data/pages/php.txt · 最后更改: 2008/06/30 01:50 由 admin
到顶部
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0