if语句包含页面php的错误 [英] error with if statement to include pages php

查看:83
本文介绍了if语句包含页面php的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一组页面,我希望包含其中一个依赖于url中的变量,但页面始终显示为仪表板



 link1:index.php?pth =& page = dashboard 
link2:index.php?pth = modules / institution& page = inst_classification





if statement:



 如果(isset($ page)&&!empty($ page)){
$ page = htmlspecialchars($ _ GET [ page ]);
$ pth = htmlspecialchars($ _ GET [ PTH]);
} else {
$ page = ' 仪表盘;
$ pth = ' ';
}
include(' ../ admin / template /'。$ template_fldr。' / html /'。$ pth。$ page。' .php');







当我删除其他此错误出现



注意:未定义的变量:中的pth  G:\ XAMP \\\\\\\\\\\\\\\ \ jesboost_cp\html\index.php   30  

注意:未定义的变量:页面 G:\ XAMP \\\\\\\\\\\\\\\\ span class =code-keyword>
30

警告:include(../ admin / template / jesboost_cp /html/.php):失败 打开流:没有这样的文件目录 G:\ XAMP \\\\\\\\\\\\\\\\\ / span> line 30

警告:include():无法打开'





谢谢

解决方案

页面)&& !empty(


page)){


page = htmlspecialchars (

hi,

I have a group of pages, and I want include one of them Dependent on a variable in url, but the page is always appear is dashboard

link1 : index.php?pth=&page=dashboard
link2 : index.php?pth=modules/institution&page=inst_classification



if statement :

if (isset($page) && !empty($page)) {
    					$page = htmlspecialchars($_GET["page"]);    
    					$pth = htmlspecialchars($_GET["pth"]);    
    				}else{  
    					$page ='dashboard';
    					$pth = ''; 
    				}
    			    include ('../admin/template/'.$template_fldr.'/html/'.$pth.$page.'.php'); 




when i remove else this error appear

Notice: Undefined variable: pth in G:\XAMP\htdocs\ic\admin\template\jesboost_cp\html\index.php on line 30

Notice: Undefined variable: page in G:\XAMP\htdocs\ic\admin\template\jesboost_cp\html\index.php on line 30

Warning: include(../admin/template/jesboost_cp/html/.php): failed to open stream: No such file or directory in G:\XAMP\htdocs\ic\admin\template\jesboost_cp\html\index.php on line 30

Warning: include(): Failed opening '../admin/template/jesboost_cp/html/.php' for inclusion (include_path='.;G:\XAMP\php\PEAR') in G:\XAMP\htdocs\ic\admin\template\jesboost_cp\html\index.php on line 30



thanks

解决方案

page) && !empty(


page)) {


page = htmlspecialchars(


这篇关于if语句包含页面php的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆