摘要:
PHP中echo和print 的功能基本相同(输出 ),但是两者之间还是有细微差别的。1、返回值echo输出后没有返回值。print有返回值,当其执行失败时返回flase。因此print可以作为一个普通函数来使用,这意味着print可用在一些复杂的表达式中,而echo则不行。但是,因为echo语句不要求返回任何数值,所已在代码中echo语句的运行效率要略微快于print语句。2、输出字符串echo 可以同时输出多个字符串。echo $test1 . 'and' .$test2;print()只能输出一个字符串。需要括号括起。print()用法会对输出内容的%做特殊处理。prin 阅读全文
摘要:
php5.2 默认是有 json 的,但我的ubuntu 9.10上没有。1. 下载 php-json 源码, 我下的是 php-json-ext-1.2.0.tar.bz22. 解压,进入目录。3. 编译前要初始化PHP环境: phpize 如果提示找不到该命令,就 apt-get install php5-dev 安装它。4. 编译json sudo ./configure sudo make5. 安装iltaek@iltaek-desktop:~/php-json-ext-1.2.1$ sudo make installInstalling shared extensions: /us. 阅读全文