Google PHP API自动加载文件-它是否替换所有单独的require_one调用


Google PHP API autoload file - Does it replace all the individual require_once calls?

在许多文档中,以及关于Google PHP API客户端的许多问题中,它显示的代码如下:

<?php
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_StorageService.php';

但现在使用自动加载器时,这是不必要的吗?

<?php
require_once realpath(dirname(__FILE__).'/google-api-php-client/src/Google/autoload.php');

是的,它替换了所有单独的require_once调用。