实时服务器无法在 Laravel 中很好地联系我们
P粉495955986
P粉495955986 2023-09-03 22:13:10
[PHP讨论组]
<p>我本地的 Laravel 项目运行良好。但在使用实时服务器托管项目后,除了联系我们表格之外,它一切正常。 这是我的联系表</p> <pre class="brush:php;toolbar:false;">&lt;div class=&quot;content&quot;&gt; @include('partials.alerts') &lt;h1 class=&quot;heading&quot;&gt;Contact Us&lt;/h1&gt; &lt;form method=&quot;post&quot; action=&quot;{{url('form')}}#contact&quot;&gt; {{csrf_field()}} &lt;div class=&quot;form&quot;&gt; &lt;div class=&quot;input-flex&quot;&gt; &lt;input type=&quot;text&quot; name=&quot;name&quot; placeholder=&quot;Name*&quot; /&gt;&lt;br&gt;&lt;br&gt; &lt;span style=&quot;color:red&quot;&gt;@error('name'){{$message}}@enderror&lt;/span&gt; &lt;input type=&quot;email&quot; name=&quot;email&quot; placeholder=&quot;E-mail*&quot; /&gt;&lt;br&gt;&lt;br&gt; &lt;span style=&quot;color:red&quot;&gt;@error('email'){{$message}}@enderror&lt;/span&gt; &lt;input type=&quot;tel&quot; class=&quot;full-width&quot; name=&quot;telephone&quot; placeholder=&quot;Phone number*&quot; /&gt;&lt;br&gt;&lt;br&gt; &lt;span style=&quot;color:red&quot;&gt;@error('telephone'){{$message}}@enderror&lt;/span&gt; &lt;textarea cols=&quot;2&quot; rows=&quot;2&quot; class=&quot;full-width&quot; name=&quot;message&quot; placeholder=&quot;Message&quot;&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;button class=&quot;conbtn&quot; type=&quot;submit&quot;&gt;Submit&lt;/button&gt;</pre> <p>我的联系人滚动导航是</p> <pre class="brush:php;toolbar:false;">&lt;nav class=&quot;navbar&quot;&gt; &lt;a href=&quot;#contact&quot;&gt;contact&lt;/a&gt; &lt;/nav&gt;</pre> <p>联系我们的控制器是</p> <pre class="brush:php;toolbar:false;">protected function store(Request $request) { //validate request $this-&gt;validate($request,[ 'name' =&gt; 'required|max:100', 'email' =&gt; 'required|email', 'telephone' =&gt; 'required', ]); $user = new User; $user-&gt;name = $request-&gt;input('name'); $user-&gt;email = $request-&gt;input('email'); $user-&gt;telephone = $request-&gt;input('telephone'); $user-&gt;message = $request-&gt;input('message'); $user-&gt;save(); $verifyUser = VerifyUser::create([ 'user_id' =&gt; $user-&gt;id, 'token' =&gt; Str::random(40) ]); Mail::to($user-&gt;email)-&gt;send(new VerifyMail($user)); return redirect('/#contact')-&gt;with('info', 'We sent you an activation code. Check your email and click on the link to verify'); }</pre> <p>我的联系我们验证消息和验证消息在提交提交按钮后重定向到联系部分。这个系统在我的本地机器上运行良好。但在实时服务器中收到以下错误消息 <code>抱歉,该页面不存在。请检查 URL 或返回页面。 404 错误。找不到页面。</code></p> <p>提交联系表单后,我可以监控本地和实时服务器中是否有不同的网址 本地主机就像 <code>http://localhost:8000/#contact</code></p> <p>但是实时服务器就像<code>https://academi.com/form#contact</code></p> <p>我对此感到困惑。我该如何解决这个问题</p>
P粉495955986
P粉495955986

全部回复(1)
P粉099000044

我会检查您的服务器配置。如果它在本地工作但不在实时服务器上工作,那么可能存在问题。检查您的 apache/nginx 配置是否匹配,尤其是在重写 url 方面

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号