Best practices for URL with space and special characters

前端 未结 1 1242
庸人自扰
庸人自扰 2021-01-22 03:57

I\'m currently modifying a small web application. This web application allow users to enter / specify a category themselves. I noticed that in the database, there\'s plenty of c

1条回答
  •  一生所求
    2021-01-22 04:37

    I prefer to use the "slug" method. You could "slugify" the strings and use the slug in the url.

    http://sourcecookbook.com/en/recipes/8/function-to-slugify-strings-in-php

    You'll need to add a column to the database for the slug, but then you can easily represent user input fields in the url and make them readable. "function-to-slugify-strings-in-php" is a slug that probably originally looked something like "Function to slugify strings in PHP".

    0 讨论(0)
提交回复
热议问题