2013-12-10 85 views
0

我尝试从我的后端跨越ajax重新使用代码,使用OOP模式和受保护的女巫htaccess编写。我的问题是,当要求页面时,我想避免前端用户的身份验证弹出窗口。允许php访问htacess保护代码

药结构

-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

您已经登录后端(通过HTTP身份验证),客户端通过AJAX向控制器发送进一步的请求......这是您的情况吗? – bitfox

回答

0

As/admin受htaccess保护,您不能从外部请求它。你可以在/前端申请一个文件,并从那里包含你的控制器。