gpt4 book ai didi

php - 使用命名空间并包含一个库

转载 作者:行者123 更新时间:2023-12-04 16:54:56 25 4
gpt4 key购买 nike

我刚刚在我的 xampp 上安装了 memcache,但是我在将它包含到我的使用命名空间的文件中时遇到了问题。

我必须如何调用它才能让它在我的命名空间下工作?我只试过这样做:

$memcache = new Memcache;

但它说:
Fatal error:  Class 'Test\Memcache' not found in x

最佳答案

您必须像这样使用完全限定名称:

$memcache = new \Memcache;

关于php - 使用命名空间并包含一个库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18431338/

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