Php 未捕获错误:类';SimpleXMLElement';找不到

Php 未捕获错误:类';SimpleXMLElement';找不到,php,simplexml,php-7,Php,Simplexml,Php 7,SimpleXMLElement不工作 检查php-v: PHP 7.4.8 (cli) (built: Jul 13 2020 16:45:28) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies php-m: php -m [PHP Modul

SimpleXMLElement不工作

检查php-v:

PHP 7.4.8 (cli) (built: Jul 13 2020 16:45:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies
php-m:

php -m
[PHP Modules]
...
SimpleXML
..
xml
xmlreader
xmlwriter
xsl
...
我使用PHP7.2,安装PHPXML、PHPSimpleXML等

日志:

php:


在我的支持Ubuntu的PHP7.0上。需要PHP7.4吗

sudo a2dismod php7.0
sudo a2enmod php7.4
sudo service apache2 restart

谢谢大家的帮助。

尝试以下操作:
$robo\u response=new\simplexmlement($response)我正在尝试。我也有错误。您已经共享了命令行配置,但是您运行了代码表单
/var/www/html
,这表明您使用了web服务器。你能确认一下你的环境是什么吗?
 $myCurl = curl_init();
  curl_setopt_array($myCurl, array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => http_build_query(array($body))
  ));
  $response = curl_exec($myCurl);
  curl_close($myCurl);
  
$robo_response = new SimpleXMLElement($response);
sudo a2dismod php7.0
sudo a2enmod php7.4
sudo service apache2 restart