调试有点问题,达人看看这段代码有问题吗?<?
if(!empty($bqr[自定义字段]))
{
$a = 'http://';
if(esub($bqr[自定义字段],7)!==$a)
{
?>
<a href="http://<?=$bqr[自定义字段]?>" target="_blank"><?=$bqr[title]?></a>
<?
}else
{
?>
<a href="<?=$bqr[自定义字段]?>" target="_blank"><?=$bqr[title]?></a>
<?
}else
{
?>
<a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a>
<?
}
?>

解决方案 »

  1.   

    没什么出错信息,在cms里测试的,就是不能运行,我只是想大家帮忙看看if语句有没有问题?  因为如果不声明a和判断前7位字母的话是正确的,以前调试的正确的我贴出来给大家看下。正确如下<?
    if(!empty($bqr[字段]))
    {
    ?>
    <a href="http://<?=$bqr[字段]?>" target="_blank"><?=$bqr[title]?></a>
    <?
    }else
    {
    ?>
    <a href=" <?=$bqsr[titleurl]?>" target="_blank"> <?=$bqr[title]?> </a>
    <? 
    }
    ?>但是加了个功能就不对了,帮忙啊哥们们。
      

  2.   

    注意养成好代码格式化的好习惯。<?
    if(!empty($bqr[自定义字段]))
    { // 找不到对应的 } , acmain
    $a = 'http://';
    if(esub($bqr[自定义字段],7)!==$a)
    {
    ?>
    <a href="http:// <?=$bqr[自定义字段]?>" target="_blank"> <?=$bqr[title]?> </a>
    <?
    }else
    {
    ?>
    <a href=" <?=$bqr[自定义字段]?>" target="_blank"> <?=$bqr[title]?> </a>
    <?
    }else // if else ,多了个 else ! , acmain
    {
    ?>
    <a href=" <?=$bqsr[titleurl]?>" target="_blank"> <?=$bqr[title]?> </a>
    <?
    }
    ?>