温馨提醒
如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢
本文最后更新于2023年11月29日,已超过 180天没有更新
默认内容页帝国CMS判断方法:
<?php
if($navinfor[befrom]){
?>
<p>来源:[!--befrom--]</p>
<?php
}?>
利用PHP语法输出判断结果:
<?php
if($navinfor[befrom]){
echo"来源:".$navinfor[befrom];
}?>
<?phpif($navinfor[befrom]){
echo"来源:".ReplaceBefrom($navinfor[befrom]);
}
?>
结合if else来使用:
<?php
if($navinfor['befrom']){
?>
<p>[!--befrom--]</p>
<?php
}else{
?>
我的站长站
<?php
}?>
empty的方法:
<?php if(!empty($classr[classimg])){
echo '<img src="'.$classr[classimg].'">';
}else{
echo '';
}
?>
注释:!(为不)+empty(为空)=!empty(不为空)
各种判断调用作者的方法:
<?=ReplaceBefrom($navinfor[befrom]?$navinfor[befrom]:'哈哈源码网')?> <?=$navinfor[befrom]?'来源:'.$navinfor[befrom].'':''?> <?=$navinfor[befrom]?"来源:$navinfor[befrom] ":""?> 注释: 为空格 <?=$navinfor[befrom]?$navinfor[befrom]:"暂无简介 "?> <? echo $navinfor['befrom']?'<span>来源:'.$navinfor[befrom].'</span>':'暂无来源';?> <?=$navinfor[writer]?:"暂"?>
switch判断方法:
<?php
switch($class_r[$GLOBALS[navclassid]]['bname']){
case "国内":
$sid = 34;
break;
case "国际":
$sid = 35;
break;
default:
$sid = 34;
}
?>
<?=$sid?>
包括多值时的判断:
<?php
$c1_r=array(35,34);
$c2_r=array(36,37);
if(in_array($GLOBALS[navclassid],$c1_r)){
$cid1='广告1';
}elseif(in_array($GLOBALS[navclassid],$c2_r)){
$cid1='广告2';
}else{
$cid1='其他广告';
}?>
<?=$cid1?>
或直接输出:把 $cid1 = 改为 echo
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系客服QQ3387285338进行处理。


评论0+