226得票6回答
从源代码安装PHP时如何修复xml2-config未找到的错误?

我试图从源代码安装php 5.3稳定版到Ubuntu上(从http://www.php.net/downloads.php下载压缩的安装文件),当我运行./configure时,出现以下错误:configure: error: xml2-config not found. Please che...

203得票6回答
PHP中self::$bar和static::$bar有什么区别?

在下面的示例中,使用self和static有什么区别?class Foo { protected static $bar = 1234; public static function instance() { echo self::$bar; ...

96得票3回答
在DateInterval格式中,'P'代表什么?

考虑以下示例,引用自PHP手册的DateTime部分<?php $date = new DateTime('2000-01-20'); $date->sub(new DateInterval('P10D')); echo $date->format('Y-m-d'...

87得票3回答
什么是 PHP 5.3 中的 ?:?

可能是重复问题: PHP运算符“?”和“:”被称为什么,它们有什么作用? 来自http://twitto.org/<?PHP require __DIR__.'/c.php'; if (!is_callable($c = @$_GET['c'] ?: fun...

52得票3回答
使用头部为application/x-www-form-urlencoded的curl进行POST请求

$post_data="dispnumber=567567567&extension=6"; $url="http://xxxxxxxx.xxx/xx/xx"; 我需要使用cURL php发布此$post_data,并使用头部application/x-www-form-urlenco...

45得票7回答
如何解决session_register()废弃问题?

如何解决PHP 5.3中session_register()方法已弃用的问题

37得票10回答
PHP Composer 在 http 代理后面的问题

我在一个只能使用HTTP或socks代理访问互联网的网络中使用Composer。我设置了http_proxy和https_proxy环境变量。当Composer尝试访问HTTPS URL时,我会得到以下错误信息: file could not be downloaded: failed to ...

36得票1回答
PHP5.3中的自执行函数是什么?

我尝试从JS中借用一些编程范式到PHP中(只是为了好玩)。有没有办法做到这一点?$a = (function(){ return 'a'; })(); 我认为通过结合use,这可以是一种像JS样式隐藏变量的好方法。$a = (function(){ $hidden = 'a'; ...

36得票1回答
LogicException和RuntimeException的区别

我想知道PHP中何时使用哪个异常规则... 什么时候必须抛出LogicException,什么时候需要抛出RuntimeException? 例如,对于像PageNotFoundException这样的异常,我应该继承哪个异常类呢?

24得票1回答
2个php.ini文件

我发现: 当我在终端中键入以下内容时:php -i | grep php.ini 我得到的输出是: 加载的配置文件为@ /etc/php5/cli/php.ini 然而,从 phpinfo() 中,我看到: 加载的ini文件为@ /etc/php5/apache2/p...