0
我使用laravel 5.2的优秀algolia/algoliasearch-laravel包。在Laravel/Algolia处理令人困惑的slu URL URL
我的一个“产品”我上传到Algolia有产品名称中斜杠:
蒂尔雄鹿羊绒围巾/披肩由埃尔金Johnstons
这是改变入使用cviebrock /口才-sluggable封装所以下面的网址:
/产品/妇女/山羊绒%20Patterned%20Scarves/TEAL-雄鹿绒-围巾++偷逐johnstons-的埃尔金
请注意++之间的围巾和偷东西。
当这上传到Algolia我得到这个:
objectID: 8122
name: "Teal Stag Cashmere Scarf/Stole by Johnstons of Elgin"
imgsrc: "Stag Teal Cashmere Stole (Small)_small.jpg"
rank: 0
url: "https://mywebsite.com/products/women/Cashmere Patterned Scarves/teal-stag-cashmere-scarfstole-by-johnstons-of-elgin"
见algolia该网址是多么的不好吗?我已经尝试过在++中加入url,但是现在我已经迷失方向了。
尝试'%2F',而不是'/'你的URL可能需要URL编码 – Farkie
耶 - 这结果在Algolia结束(我使用的是preg_replace)'/ teal-stag-cashmere-scarf2fstole-by-johnstons-of-elgin' 我会看看我是否可以在将URL编码传入之前进行编码 –
@Farkie - urlencoding使情况变得更糟糕lol'/ tealstagcashmerescarf2fstolebyjohnstonsofelgin' –