我很想知道,當在一個類的開始處用PHP聲明使用語句時,爲什麼每次使用「use」關鍵字通常都會重複,即使它是 可能會在末尾放置一個昏迷接下來的聲明,如下所示:PHP「使用」聲明重複或用逗號?
namespace Behat\Mink;
use Behat\Mink\Driver\DriverInterface,
Behat\Mink\Selector\SelectorsHandler,
Behat\Mink\Element\DocumentElement;
與此不同:
namespace Symfony\Bundle\FrameworkBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormBuilder;
use Symfony\Bundle\DoctrineBundle\Registry;
use Symfony\Component\HttpFoundation\Request;
它只是緩解了複製/粘貼?模仿Java的導入語句? 或者我們只是不在乎... :)
第二種方法,你可以輕鬆地搜索您使用的語句代碼(即用grep)。 – Progrock 2016-08-22 07:42:11