gpt4 book ai didi

sql - 如何在 CAKEphp 中阻止 sql 注入(inject)

转载 作者:行者123 更新时间:2023-12-03 18:10:19 28 4
gpt4 key购买 nike

如何阻止来自像这样的页面的 sql 注入(inject)... http://u.neighborrow.com/items/recent

最佳答案

CakePHP already protects you against SQL Injection if you use CakePHP's ORM methods (such as find() and save()) and proper array notation (ie. array('field' => $value)) instead of raw SQL. For sanitization against XSS its generally better to save raw HTML in database without modification and sanitize at the time of output/display.



这应该让您对如何做到这一点有一个很好的了解。
App::import('Sanitize'); 
class MyController extends AppController { ... ... }

完成此操作后,您可以静态调用 Sanitize。

关于sql - 如何在 CAKEphp 中阻止 sql 注入(inject),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4137826/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com