【问题标题】:Fatal error: Cannot instantiate non-existent class: simplexmlelement致命错误:无法实例化不存在的类:simplexmlelement
【发布时间】:2010-11-16 09:16:19
【问题描述】:

我正在使用这个 php 脚本

$error = false;
if(isset($_POST['login'])){
    $username = preg_replace('/[^A-Za-z]/', '', $_POST['username']);
    $password = md5($_POST['password']);
    if(file_exists('users/' .$username . '.xml')){
        $xml = new SimpleXMLElement('users/' .$username . '.xml', 0, true);
        if($password == $xml->password){
            session_start();
            $_SESSION['username'] = $username;
            header('Location: agis-employees.html');
            die;
        }
    }
    $error = true;
}

我最终得到了这个错误

致命错误:无法实例化 不存在的类:simplexmlelement 在 /home/virtual/site250/fst/var/www/html/employeeportal/index.php 在第 7 行

【问题讨论】:

    标签: php


    【解决方案1】:

    这很可能意味着 SimpleXML 扩展未在您的 PHP 安装中启用/存在。您可以通过执行phpinfo() 并查找“SimpleXML”来验证这一点。见:

    http://www.php.net/manual/en/simplexml.installation.php http://www.php.net/manual/en/book.simplexml.php

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-04
      • 1970-01-01
      相关资源
      最近更新 更多