localhost.test/teacher/marklist
- teacher
是 Controller ,marklist 是 View 页面。
学生
登录并输入上述url
将显示该页面。
如何防止这种情况发生?
最佳答案
有很多方法可以防止它,但在 Zend 中建议的方法是使用 Zend_Acl 并创建角色:学生、教师和资源。
您可以阅读有关 Zend 访问控制列表的更多信息 here .
来自Zend Page :
Zend_Acl provides a lightweight and flexible access control list (ACL) implementation for privileges management. In general, an application may utilize such ACL's to control access to certain protected objects by other requesting objects.
For the purposes of this documentation:
a resource is an object to which access is controlled.
a role is an object that may request access to a Resource
所以基本上你需要做:
- 身份验证 - 简单的登录表单并将数据保存在 session 中
- 授权 - Zend_Acl 可能有用。
关于php - 如何在zend框架中直接输入url来限制学生和老师访问对方的页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17547418/