2012-09-16 67 views
0

我產生我的,沒有錯誤的NetBeans捆綁控制器,然後跑到我的主配置文件中的應用程序目錄,並設置這樣的:不能運行在symfony 2

first_app: 
resource: "@FirstAppBundle/Resources/config/routing.yml" 
prefix: /

然後設置這在我的包路由。 YML文件:當我去那裏

namespace DimaVendor\MytestsBundle\Controller; 

use Symfony\Bundle\FrameworkBundle\Controller\Controller; 
use Symfony\Component\HttpFoundation\Response; 

class HelloController extends Controller { 

    public function indexAction($name) { 
     return new Response('<html><body>' . $name . '</body></html>'); 
    } 



} 

我得到404:

first_app_homepage: 
pattern: /hello/{name} 
defaults: { _controller: FirstAppBundle:Hello:index } 

我有這個控制器

http://localhost/app.php/hello/Ryan 

爲什麼?

我還清理我的緩存,並沒有發現錯誤

+0

您是否將symfony應用程序安裝在web服務器根目錄或任何子文件夾中? – moonwave99

+0

在project1..This這是netbeans如何創建它們...把所有內容放在子文件夾中 – BlackFire27

+0

即使這不會工作:http://localhost/PhpProject1/app_dev.php/hello/Ryan – BlackFire27

回答

0

app.phpapp_dev.php腳本是Symfony的應用程序的入口點,並且它們位於項目web/子目錄 - 在這種情況下,將瀏覽器指向:

http://localhost/PhpProject1/web/app_dev.php/hello/Ryan

.htaccess進來web/文件夾,並重定向任何要求:

http://localhost/PhpProject1/web/some/path 

到:

http://localhost/PhpProject1/web/app.php/some/path 
你的情況

。看一看!