PHP 和文件路径帮助

发布于 2024-11-14 04:39:52 字数 1143 浏览 1 评论 0原文

我现在使用的是 Windows,但我需要我的脚本在 Windows 或 Linux 上运行。我正在开发一个允许将视频上传到 youtube 的项目,youtube 库需要使用 Zend 框架(不幸的是),所以我真的很努力让它工作,但没有运气。

所以我的页面显示

Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No 
such file or directory in 
E:\Server\htdocs\clients\youtube2\demos\Zend\Gdata\YouTubeVideoApp\operations.php on line 37

我有 Zend 框架,

E:\Server\htdocs\frameworks\Zend

然后尝试设置包含路径,以便脚本可以访问 Zend,这就是我的麻烦开始的地方。我尝试使用这个...

$path = 'E:/Server/htdocs/frameworks/Zend/';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

但我仍然收到上面看到的错误,现在您可以看到上面脚本的路径和我的 Zend 的路径,有人可以告诉我如何设置包含路径才能正常工作?感谢您的帮助,


到目前为止我尝试了一些建议但没有运气。这是我更新的代码和结果

$path = 'E:\Server\htdocs\frameworks';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
echo get_include_path();

给出了这个...

E:\Server\php\PEAR;E:\Server\htdocs\frameworks

所以看起来我的 zend 包含路径已添加,但它仍然说找不到它


最终更新!

它正在工作,就在我设置包含路径的地方没有包含在所有文件中,有没有办法设置包含路径并使其在全局范围内可用?

I am using windows right now but I need my script to work on windows or linux. I am working on a project which allows to upload video to youtube, the youtube library requires the use of Zend framework (unfortunately) so I am really trying to get it to work, with no luck.

So my page says

Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No 
such file or directory in 
E:\Server\htdocs\clients\youtube2\demos\Zend\Gdata\YouTubeVideoApp\operations.php on line 37

I have Zend framework located at

E:\Server\htdocs\frameworks\Zend

I then try to set the include path so that the scripts have access to Zend, thats where my trouble starts. I try to use this...

$path = 'E:/Server/htdocs/frameworks/Zend/';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

But I still get the error that you see above, now that you can see the path of my script above and the path of my Zend, can someone show me how to set the include path to work correctly? Thanks for any help


I tried some suggestions with no luck so far. Here is my updated code and result

$path = 'E:\Server\htdocs\frameworks';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
echo get_include_path();

Gives this...

E:\Server\php\PEAR;E:\Server\htdocs\frameworks

So it appears my include path for zend is added, but it still says it cannot find it


Final Update!

It is working, just where I set the include path wasn't getting included into all the files, is there a way to set the include path and have it be available globally?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

躲猫猫 2024-11-21 04:39:52

如果您想更改php.ini中的包含路径,只需更改include_path即可。查看本教程,了解多种更改包括路径。

If you want to change the include path in php.ini, just change include_path. Check out this tutorial to find out about a myriad of ways of changing the include path.

你另情深 2024-11-21 04:39:52
E:\Server\htdocs\frameworks\Zend

$path = 'E:/Server/htdocs/frameworks/Zend/';

可能会对您的系统产生影响?尝试使用 \ 而不是 /

E:\Server\htdocs\frameworks\Zend

versus

$path = 'E:/Server/htdocs/frameworks/Zend/';

might make a difference on your system? Try it with \ instead of /.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文