Removing ID from CakePHP URL?

前端 未结 3 532
没有蜡笔的小新
没有蜡笔的小新 2021-01-29 04:44

Hey guys! Working on a new Cake app and wondering if there is anyway for me to remove the ID-in-URL routing from Cake. Perhaps by passing the ID in POST somehow? Having the ID p

3条回答
  •  春和景丽
    2021-01-29 04:56

    "Shoddy"? It's standard practice and a perfectly fine solution to have ids in the URL. Look at the URL of your question:

    http://stackoverflow.com/questions/4638262/removing-id-from-cakephp-url
                                       ^^^^^^^
                                          id
    

    Also, there's absolutely nothing unsafe about showing an id in a URL. It's just a number that doesn't mean anything. If a user can do something "bad" only by knowing this id, your app is broken and insecure, not the id-passing mechanism.

    Trying to work around this scheme means working around the fundamental principle of the HTML protocol and opens up a whole new can of worms.

提交回复
热议问题