gpt4 book ai didi

php - YouTube API 没有这样的文件或目录

转载 作者:行者123 更新时间:2023-12-03 05:27:55 24 4
gpt4 key购买 nike

我是 PHP 新手,在 http://www.youtube.com/watch?v=LMhN6pCAZWo 试用 YouTube API 演示.

我有他说要下载的 google-api-php-client 和 yt-samples-php-master 目录

www.mysite.com/video/google-api-php-client 和
www.mysite.com/video/yt-samples-php-master

search.php 文件位于 yt-samples-php-master 中,我复制了视频并设置:

if ($_GET['q'] && $_GET['maxResults']) {
set_include_path("./google-api-php-client/src");
// Call set_include_path() as needed to point to your client library.
require_once 'Google_Client.php';
require_once 'contrib/Google_YouTubeService.php';

我可以很好地访问 www.mysite.com/videos/yt-samples-php-master/search.php 但是当我搜索时我收到消息:

警告:require_once(Google_Client.php) [function.require-once]:无法打开流:/home/myusername/mysite.com/videos/yt-samples-php-master/search.php 中没有这样的文件或目录第 17 行

fatal error :require_once() [function.require]:无法在/home/myusername/mysite.com/videos/中打开所需的“Google_Client.php”(include_path='./google-api-php-client/src/') yt-samples-php-master/search.php 在第 17 行。

我注意到 Google 提供的文件有一个拼写错误 require_once 'contrib/Google_YoutubeService.php';应该是 require_once 'contrib/Google_YouTubeService.php';
但这似乎没有帮助。任何线索将不胜感激!

编辑:我还通过视频目录将 755 递归设置为子目录和文件

最佳答案

晚了。但将来有人可能会寻找这个。

解决方案:

  • Google 的 php 客户端使用 composer,因此,您必须将路径放入自动加载文件。
    链接:Google API PHP client
  • 删除或注释掉 Google_Client.php 和 contrib/Google_YoutubeService.php 的 require_once() 方法
  • 在实例化
  • 时将类名从 Google_YoutubeService 重命名为 Google_Service_YouTube

    关于php - YouTube API 没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20117164/

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