我尝试重复使用我的后端跨越ajax的代码,用OOP模式编写并保护wtaccess。我的问题是,我想避免在请求页面时为前端用户提供身份验证弹出窗口。
药结构
-admin
-controllers
--oneofmycontroller.php
-models
--oneofmymodel.php
-views
-index.php
-.htaccess
-fontend
-myphpfiles
method.php// and here I try to access one of my controller to fetch datas
以及我如何尝试访问
like /admin?controller=oneofmycontroller&action=methodToCall
前端代码尚不兼容OOP
方案
vistor->access public page->public page calls back-end script across ajax to fetch data(which is htacess protected) -> if visitor is not logged-in sees a pop-up (and this one I would like to avoid but on the same time keep my back-end safe)
答案 0 :(得分:0)
由于/ admin受htaccess保护,您无法从外部请求。您可以在/ frontend中请求文件并从那里包含您的控制器。