簡體   English   中英

Symfony2項目在遠程服務器上的問題

[英]Symfony2 project on a distant server problems

我現在要花大約兩周的時間在托管服務器上運行一個網站(非常簡單,僅用於測試HelloWorld之類的第一步),但仍然一無所獲。

我是symfony的新手,可能是我的錯誤是“正常”,但我無法在互聯網上找到答案。 所以我的問題是以下幾點:

我使用symfony2在PC上開發了一個網站。 它只有一點html / css頁面,我想在服務器上看到。 在本地,一切正常:沒有錯誤,什么也沒有。 當我在主機( http://www.nexlink.ch/ )上通過FTP上傳整個項目(清除緩存后)時,出現以下錯誤:

Oops! An Error Occurred

The server returned a "500 Internal Server Error".

Something is broken. Please e-mail us at [email] and let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

記錄器告訴我以下內容:

INFO - Matched route "HelloTheWorld" (parameters: "_controller": "fcbgNewsBundle:news:index", "name": "bolet", "_route": "HelloTheWorld")

CRITICAL - Uncaught PHP Exception InvalidArgumentException: "Unable to find controller "fcbgNewsBundle:news" - class "fcbg\newsBundle\Controller\newsController" does not exist." at /mnt/sites/fc-beroche.ch/web/fusio/app/cache/dev/classes.php line 2333 
Context: {"exception":"Object(InvalidArgumentException)"}

我做錯了什么?

這是我的控制器:

<?php

namespace fcbg\newsBundle\Controller;

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

class newsController extends Controller
{
  public function indexAction($name)
  {
    echo $name;
    $page = $this->render(
            'base.html.twig', 
            array(
                'content' => 'fcbgNewsBundle:Default:index.html.twig',
                'titrePage' => $name,
                'navigation' => array(
                    array(
                        'href' => 'http://www.youpi.com', 
                        'titre' => 'menu1'
                    ),
                    array(
                        'href' => 'http://www.youpi.com', 
                        'titre' => 'menu2'
                    ),
                    array(
                        'href' => 'http://www.youpi.com', 
                        'titre' => 'menu3'
                    ),
                ),
                'css' => 'fcbgNewsBundle:Default:basicStyle.css'
            )
    );
    return $page;
  }
}

問題可能在這里:

INFO - Matched route "HelloTheWorld" (parameters: "_controller": "fcbgNewsBundle:news:index", "name": "bolet", "_route": "HelloTheWorld")

如您所見:

fcbgNewsBundle:news:index

預期為

fcbg\NewsBundle\newsController -> indexAction

但是你有:

namespace fcbg\newsBundle\Controller;
               ^

n帶有情人案例的人物。 使用大寫字母,並且您還應該在控制器名稱的開頭( NewsController而不是newsController )使用大寫字符,以避免將來出現這些問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM