Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Phpfreechat:如何从另一个目录调用它_Php_Chat - Fatal编程技术网

Phpfreechat:如何从另一个目录调用它

Phpfreechat:如何从另一个目录调用它,php,chat,Php,Chat,我正在使用此聊天: 我把它放在一个名为聊天的文件夹中,当它运行时,一切看起来都很好。但是,如果我尝试将它包含在另一个文件中,一个文件夹中,它会说: Strict Standards: Non-static method pfcGlobalConfig::Instance() should not be called statically, assuming $this from incompatible context in /home/brianl/repo/video_server/sfpr

我正在使用此聊天:

我把它放在一个名为
聊天
的文件夹中,当它运行时,一切看起来都很好。但是,如果我尝试将它包含在另一个文件中,一个文件夹中,它会说:

Strict Standards: Non-static method pfcGlobalConfig::Instance() should not be called statically, assuming $this from incompatible context in /home/brianl/repo/video_server/sfproject/apps/frontend/modules/job/templates/chat/src/phpfreechat.class.php on line 44 .....
通过使用正确调用文件

require_once dirname(__FILE__).'/pfccommand.class.php';
并且没有路径错误

有什么想法吗?
谢谢

我会检查pfccommand.class.php,以确保该类文件中没有相关包含。当我第一次开始用PHP编程时,由于两个不同页面之间的一个相对包含问题,我被困了两周。我通过使用半静态includes解决了这个问题(就像您在示例中使用
dirname(\uuu FILE\uuu)

编辑:

好的,当您知道目录结构时,您可以使用这些知识动态地构建它。你只需要确保文件保存在它们应该保存的地方。例如:

realpath(dirname(_文件).'/.';

这将为您提供完整的目录,位于当前文件目录的正下方。这就是我所说的动态目录。静态目录将是:


include_once('/var/www/website/public_html/filename.php');
这要求目录结构每次都相同,如果您更换主机或需要将文件推送到一个目录,这会很麻烦。

toy可以提供一个相对include和静态include的示例吗?