[英]Symfony2 components class not found
我正在嘗試在沒有完整框架的情況下使用Symfony2的Request
和Response
組件。 這是我的代碼:
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$r = Request::create( 'https://example.com', 'GET' );
$response = $r->getResponse();
$content = $response->getContent();
我得到這個錯誤:
PHP致命錯誤:在第6行的/root/billing/web/index.php中找不到類'Symfony \\ Component \\ HttpFoundation \\ Request'
您需要使用ClassLoader
組件來自動加載您的類,否則您將不得不require()
類文件。 不用編寫自己的自動裝帶器 。
請參閱本文檔的“命名約定和自動加載”部分
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.