Tencent / Biny

Biny is a tiny, high-performance PHP framework for web applications
BSD 3-Clause "New" or "Revised" License
1.69k stars 259 forks source link

视图中绑定参数问题 #44

Closed David3310273 closed 6 years ago

David3310273 commented 6 years ago

如果按照新版的配置'paramsType'] => 'one',该怎样用display在视图中绑定参数?

billge1205 commented 6 years ago

在action中 return $this->display('view', ['aa'=>1,'bb'=>2]); 然后在view.tpl中 可以通过 <?=$PRM['aa']?> 获取 PRM的名称也可以在config.php 中 配置paramsKey

billge1205 commented 6 years ago

参数有两种用法 <?=$PRM['aa']?> 会自动做反xss注入保护 <?=$PRM->aa?> 则返回原始数据 多层数组数据也一样 具体参考http://www.billge.cc/#view-xss

David3310273 commented 6 years ago

为什么不再直接extract($this->params)了?

billge1205 commented 6 years ago

如果这样 那就不具备 反xss的功能了 现在的页面渲染是可以不依赖开发习惯 完全屏蔽xss注入的

David3310273 commented 6 years ago

好的,谢谢