错误信息
PHP Fatal error: Call to a member function createCDATASection() on a non-object in api.class.php on line 67
PHP版本
PHP 5.3.3 (cli) (built: Jul 9 2015 17:39:00)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
已安装组件
bz2 calendar Core ctype curl date dom ereg exif fileinfo filter ftp gd gettext gmp hash iconv json libxml mbstring mcrypt mysql mysqli
openssl pcntl pcre PDO pdo_mysql pdo_sqlite Phar readline Reflection session shmop SimpleXML sockets SPL sqlite3 standard
tokenizer wddx xml xmlreader xmlwriter xsl zip zlib
报错的代码
protected static function data2xml($xml, $data, $item = 'item') {
foreach ($data as $key => $value) {
is_numeric($key) && $key = $item;
if(is_array($value) || is_object($value)){
$child = $xml->addChild($key);
self::data2xml($child, $value, $item);
} else {
if(is_numeric($value)){
$child = $xml->addChild($key, $value);
} else {
$child = $xml->addChild($key);
$node = dom_import_simplexml($child);
$cdata = $node->ownerDocument->createCDATASection($value);//此行报错
$node->appendChild($cdata);
}
}
}
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。