简体   繁体   English

Laravel 5:分页和Xampp:找不到对象

[英]Laravel 5: Pagination and Xampp: Object not found

I am doing simple pagination on a query. 我正在对查询进行简单的分页。

The pagination links at the bottom of the page are pointing to 页面底部的分页链接指向

http://localhost/reddit/public/subreddit/?page=1

but when I click on it, I get redirected to 但是当我点击它时,我被重定向到

http://localhost/subreddit?page=1

with the error 与错误

Object not found! 找不到对象!

The requested URL was not found on this server. 在此服务器上找不到请求的URL。 The link on the referring page seems to be wrong or outdated. 推荐页面上的链接似乎有误或已过时。 Please inform the author of that page about the error: 请将该错误告知该页面的作者:

If you think this is a server error, please contact the webmaster. 如果您认为这是服务器错误,请与网站管理员联系。

Error 404 错误404

localhost 本地主机

Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.11 Apache / 2.4.16(Win32)OpenSSL / 1.0.1p PHP / 5.6.11

But if I manually go to http://localhost/reddit/public/subreddit?page=2 the page loads fine. 但是,如果我手动转到http://localhost/reddit/public/subreddit?page=2则页面加载正常。

This is the url in config/app.php 这是config/app.phpurl

'url' => 'http://localhost/reddit/public',

Since your url is set to http://localhost/reddit/public , Laravel will generate relative links based on the url configuration. 由于您的网址设置为http://localhost/reddit/public ,因此Laravel将根据网址配置生成相对链接。 In other words, it's taking out http://localhost/reddit/public from all the links, and only adding subreddit?page=1 换句话说,它从所有链接中删除http:// localhost / reddit / public ,仅添加subreddit?page=1

Setting the url field in config/app.php back to 'url' => 'http://localhost/', should fix the problem config/app.phpurl字段设置回'url' => 'http://localhost/',应该可以解决此问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM