Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一堆数据从控制器传递到视图。有没有一种快速的方法来获取从控制器传递的所有数据,例如在 AppController beforeRender 中并对该数据执行 sanitize->html ?
快速方法:App::import('Sanitize');在模型中并在 beforeSave 中清理所有内容
App::import('Sanitize');
蛋糕食谱建议了一种不同的方式:
对于 XSS 的清理,通常最好将原始 HTML 保存在数据库中而不进行修改,并在输出/显示时清理。