PHP 7 simpleXML [英] PHP 7 simpleXML

查看:125
本文介绍了PHP 7 simpleXML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试PHP7,最近更新后出现了一个奇怪的问题.默认情况下,应该启用SimpleXML,并且我的phpinfo页显示它可用:

I'm testing PHP7, and have a weird issue after a recent update. SimpleXML should be enabled by default, and my phpinfo page shows that it is available:

但是,这些功能不可用:

However, the functions are not available:

<?php

if (function_exists('simplexml_load_file')) {
    echo "simpleXML functions are available.<br />\n";
} else {
    echo "simpleXML functions are not available.<br />\n";
}

// result-- NOT available

该模块未列为已加载:

~ $ php -m
[PHP Modules]
calendar
Core
ctype
curl
...
Reflection
session
shmop
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib

有人知道是否有解决方法吗?

Anyone know if there's a workaround for this?

版本信息:

~ $ php -v
PHP 7.0.3-8+deb.sury.org~trusty+2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

推荐答案

我遇到了同样的问题,并且我正在使用Ubuntu 15.10.

I had the same problem and I'm using Ubuntu 15.10.

就我而言,为了解决此问题,我使用Synaptic软件包管理器(其中包括SimpleXml)安装了php7.0-xml软件包.因此,重新启动我的Apache服务器后,我的问题解决了.这个软件包是Debian版本的,您可以在这里找到: https://packages.debian .org/sid/php7.0-xml .

In my case, to solve this issue, I installed the package php7.0-xml using the Synaptic package manager, which include SimpleXml. So, after restart my Apache server, my problem was solved. This package came in the Debian version and you can find it here: https://packages.debian.org/sid/php7.0-xml.

这篇关于PHP 7 simpleXML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆