douyi4991 2014-08-22 07:25
浏览 15
已采纳

Symfony随机网址显示404

I am working through the random number generator in the cookbook how ever when I try to access app_dev.php/random I am getting 404 and the same for app_dev.php.

My server is running cPanel and I installed Symfony via scriptalicious

When I load domain.co.nz/symfony I get

Page Message:

Symfony is installed successfully.

Symfony is a Framework, so doesn't have an index page.

How could I resolve my above issues?

Routing:

use Symfony\Component\Routing\RouteCollection;

$ranNum = $loader->import('@DemoRandomNumberBundle/Resources/config/routing.php');
$ranNum->addPrefix('/');

$collection = new RouteCollection();
$collection->add('random', new Route('/random{limit}', array('_controller' => 'DemoBundle:Random:index')));

return $collection;
  • 写回答

1条回答 默认 最新

  • dongxiaoshe0737 2014-08-22 08:59
    关注

    Your route is at the url/path /random{limit} while you are requesting /random so it isn't finding anything.

    The regex for routing parameters is [^/]+ meaning that it needs one or more characters, which you are not providing.

    To get to your page you would need you use that parameter in your url like /random123 with 123 being limit.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波