【问题标题】:Laravel route url and vuejs axious not working with unicode utf-8 issueLaravel 路由 url 和 vuejs axious 不适用于 unicode utf-8 问题
【发布时间】:2020-06-04 00:04:07
【问题描述】:

我在 slug 中使用我的项目。当我使用英语时效果很好。但是当我使用 unicode/bangla 时,它在这张图片中显示。 axious 不工作

【问题讨论】:

  • 显示axios代码
  • axios.get(http://127.0.0.1:8000/en/blog/${this.$route.params.id})

标签: laravel vue.js axios


【解决方案1】:

IT 解决了 axious 发送请求:axios.get(en/blog/${encodeURI(this.$route.params.id)}).then(response => { this.blogpostdetails = response.data.blogpostdetails;

});

和控制器:$blogpost = Blog::with('blogcategorylist','admin','blogcomment')->whereSlug(urldecode($id))->get()->first();

【讨论】:

    【解决方案2】:

    像这样更改您的请求,它会有所帮助

     let url = http://127.0.0.1:8000/en/blog/${this.$route.params.id};
     axios.get(encodeURI(url))
    

    在你的控制器中照常使用

    【讨论】:

    • 我已经用亚美尼亚字母测试过,可能你需要在你的控制器中使用 urldecode(),如果你在这里过去,我可以用你的参数测试它
    猜你喜欢
    • 2020-05-15
    • 2010-12-26
    • 2014-08-21
    • 2018-06-17
    • 1970-01-01
    • 2014-07-15
    • 1970-01-01
    • 1970-01-01
    • 2013-12-20
    相关资源
    最近更新 更多