Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php LAVEL保存在数据库中的自定义URL_Php_Laravel_Routes - Fatal编程技术网

Php LAVEL保存在数据库中的自定义URL

Php LAVEL保存在数据库中的自定义URL,php,laravel,routes,Php,Laravel,Routes,我想为我的站点成员提供自定义url,使他们的页面位于我的站点url下,如www.mysite.com/{theirurls}。 在user表中的数据库中,我有一个字段userurl,它保存我给他们的url。 在路径中我已经编写了代码 Route::get('/{fpage?}', 'AController@fofpage'); 在controller Infofpage函数中,我获取变量并在数据库中查找值。如果它属于某人,则重定向到此。如果不是,则返回/(根)。 问题是所有其他URL,如log

我想为我的站点成员提供自定义url,使他们的页面位于我的站点url下,如www.mysite.com/{theirurls}。 在user表中的数据库中,我有一个字段userurl,它保存我给他们的url。 在路径中我已经编写了代码

Route::get('/{fpage?}', 'AController@fofpage');
在controller Infofpage函数中,我获取变量并在数据库中查找值。如果它属于某人,则重定向到此。如果不是,则返回/(根)。 问题是所有其他URL,如login和其他URL都不起作用。 我怎样才能解决这个问题?
提前感谢

将此路线放在
网站的末尾
路线文件以使其工作:

Route::get('/{fpage?}', 'AController@fofpage');

您还需要验证用户URL,并且不允许用户输入诸如
登录
注册
等值。

谢谢您的回答解决了我的问题。我不记得路线句子的位置很重要。