多个require_once和活动文件夹

时间:2015-01-24 12:53:01

标签: php require-once

我尝试在WAMP上使用PHP实现Google API,但我甚至无法包含这些文件。

我的代码如下:

<?php
  require_once "./vendor/google/apiclient/src/Google/Client.php";

Client.php

require_once 'Google/Auth/AssertionCredentials.php';
require_once 'Google/Cache/File.php';
require_once 'Google/Cache/Memcache.php';
....

我的错误:

  

警告:require_once(Google / Auth / AssertionCredentials.php):失败了   open stream:中没有这样的文件或目录   C:\ wamp \ www \ mysite \ vendor \ google \ apiclient \ src \ Google \ Client.php on   第18行

我应该如何使用包含路径和类似的命令来让Client.php找到它想要的内容?

2 个答案:

答案 0 :(得分:0)

有多种方法可以找到文件。这些包括绝对路径或使用设置包含路径。包含路径可以通过以下方式设置:

  • 的php.ini
  • 的.htaccess
  • ini_set function
  • set_include_path function

请最适合您使用的

答案 1 :(得分:0)

我使用Composer解决了我的问题。