调用未定义的函数 mysqli() [英] Call to undefined function mysqli()
问题描述
此代码出现问题
<?php
define('DB_USER','root');
define('DB_PASSWORD','censored');
define('DB_HOST','localhost');
define('DB_NAME','censored');
$dbc = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
?>
我已经安装了 php7.0-mysqli 但我仍然收到这个错误信息
I have installed php7.0-mysqli but I still get this error message
PHP Fatal error: Uncaught Error: Call to undefined function mysqli() in /var/www/html/actions/create_account.php:29\nStack trace:\n#0 {main}\n thrown in /var/www/html/actions/create_account.php on line 29, referer: http://localhost/register.php
这是 mysqli 上的 phpinfo() 输出.出了什么问题?
Here is phpinfo() output on mysqli. What is going wrong?
推荐答案
错误信息非常清楚:PHP 中没有这样的功能,而且从来没有.只有一个名为mysqli_connect() 的函数和名为mysqli 的类.但是类不是函数,需要处理不同的语法
The error message is crystal clear: there is no such function in PHP and never has been. There is only a function called mysqli_connect() and class called mysqli. But classes are not functions and have different syntax to handle
这意味着,根据错误信息,在第 29 行的/var/www/html/actions/create_account.php 中的某处存在对 mysqli 的不当调用
It means that, according to the error message, somewhere in the /var/www/html/actions/create_account.php on line 29 there is an improper call to mysqli
这篇关于调用未定义的函数 mysqli()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!