Tencent / Biny

Biny is a tiny, high-performance PHP framework for web applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

web目录下的static中访问的问题

gmplato opened this issue · comments

访问static中的.CSS .JS .JPG都可以访问到,访问到.ttf .svg .ico等文件时就会提示‘Source File Not Found’,是我那里设置的问题吗?我尝试访问http://www.billge.cc/static/fonts/glyphicons-halflings-regular.ttf都是可以的,不知道是什么问题。

原来是我的nginx 伪静态 root /www/wwwroot/XXX/web/; 没有写准

嗯 正常/web/目录下直接对应根目录,底下的文件都是可以直接对应访问的。
所以注意php文件除了入口index.php外,不建议放在/web/目录下,有被外部直接访问的危险

好的,谢谢提醒

public function action_admin_role($title,$liid)
{
    $queryroledata = array();
    if($title) $queryroledata['title'] = $title;
    if($liid)  $queryroledata['groups'] = $liid;
    $queryroledata = $this->roleDAO->filter($queryroledata)->query();

    $code_rolegroup = $this->cataDAO->getcodes('user_rolegroup'); //查找对应默认分组
    $code_power = $this->cataDAO->getcodes('user_power'); //查找对应标题的用户类型

    $view = $this->response->display('admin/rigger/admin_role');
    $view->title = '角色管理';
    $view->keywords = '角色管理';
    $view->description = '角色管理';
    $view->queryroledata = $queryroledata;
    $view->code_power = $code_power;
    $view->code_rolegroup = $code_rolegroup;
    $view->title = $title;
    return $view;
}

//视图直接引用
$this->queryroledata;

请教一下,我这样向视图渲染数据,有XCC问题吗?

这样写是有xss注入问题的 可以把参数放在display方法第二个参数里

$view = $this->response->display('admin/rigger/admin_role',['queryroledata'=>$queryroledata,'code_power'=>$code_power]);

$view的子对象只对seo进行设置即可

http://www.billge.cc/#view-param
看一下这个文档,不过现在很少用php直接渲染页面了,可以返回json数据前端去做模板渲染