gpt4 book ai didi

php - fatal error : Call to undefined function imap_open() in PHP

转载 作者:IT王子 更新时间:2023-10-29 00:40:05 27 4
gpt4 key购买 nike

我正在尝试通过我的本地主机访问我的 gmail 帐户。但是,我收到了回复:

Fatal error: Call to undefined function imap_open()

这是我的代码:

$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'myid@gmail.com';
$password = 'mypassword';

/* try to connect */
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' .imap_last_error());

最佳答案

很简单,在您的 PHP 安装中没有激活 IMAP 扩展。不是enabled by default .如果您的本地安装在 Windows 上运行 XAMPP,您必须按照 XAMPP FAQ 中的说明启用它。 :

Where is the IMAP support for PHP?

As default, the IMAP support for PHP is deactivated in XAMPP, because there were some mysterious initialization errors with some home versions like Windows 98. Who works with NT systems, can open the file "\xampp\php\php.ini" to active the php exstension by removing the beginning semicolon at the line ";extension=php_imap.dll". Should be: extension=php_imap.dll

Now restart Apache and IMAP should work. You can use the same steps for every extension, which is not enabled in the default configuration.

关于php - fatal error : Call to undefined function imap_open() in PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9654453/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com