dongzj2015 2015-06-28 12:03
浏览 98
已采纳

laravel尝试访问/ what的url时访问禁止错误:任何语法

I have installed Laravel with Xampp server on Windows 7 successfully .

I tried to add routes url and it works fine.

I want to display a MySQL table values on localhost So I make a model

class data extends Model
{
protected   $table = 'Data'; 
}

and a controller class and inside this controller class this method to display MySQL table

   public function show($id)
   {
   $data = Data::where('service_id', $service_id)->select ('price' ); 
   return view('greeting')->with('data',$data); 
   }

And I add a route to display my web page showing my table data .

but I get this error

Access forbidden! You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster. Error 403

Although I haven't this error yesterday. but today I totally failed!!

I has observed that I get this error when I try to access any url likes this syntax /anything:anything e.g: /one/public/Motors:1 /one/public/planes:1

but no problem when I use no parameterized query.

  • 写回答

2条回答 默认 最新

  • donglianglu8136 2015-08-01 08:18
    关注

    I just change routes to the following and problem solved. So I have to browse my page as pagename/id instead of pagename:id

       Route::get('pagename/{id}',array('uses' =>'MyclassController@MethodName'));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条