将我的 php 版本更新到 5.4.0-3 后,我收到一个奇怪的 PHP 错误。
我有这个数组:
Array
(
[host] => 127.0.0.1
[port] => 11211
)
当我尝试像这样访问它时,我收到奇怪的警告
print $memcachedConfig['host']; print $memcachedConfig['port']; Warning: Illegal string offset 'host' in .... Warning: Illegal string offset 'port' in ...
我真的不想只编辑我的 php.ini 并重新设置错误级别。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
请尝试这种方式......我已经测试过这段代码......它有效......
$memcachedConfig = array("host" => "127.0.0.1","port" => "11211"); print_r($memcachedConfig['host']);