php基本语句

Posted 偏偏夜里下起了雨

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php基本语句相关的知识,希望对你有一定的参考价值。

<?php echo $cfg_copyright ?>
<?php require_once(dirname(__FILE__).‘/include/config.inc.php‘); ?>
<!-- 获取列表单项ID -->
<?php echo $gourl; ?>

<?php require_once(‘header.php‘); ?>
<!-- 网站标题 -->
<?php echo GetHeader(); ?>

<?php echo ReStrLen($row[‘title‘],30); ?>

<?php echo GetHeader(1,$cid); ?>

<?php echo info(2)?>
<!-- 获取目前为止 -->
<?php echo GetPosStr($cid); ?>
<!-- 手机版 链接地址地址 -->
?m=cpzx&cid=19
<!--版权所有-->
<?php echo $cfg_copyright; ?>
<!--icp-->
<?php echo $cfg_icp; ?>

<td height="105" align="center" valign="middle" class="end">地址:<?php echo $cfg_adr; ?>  邮编:<?php echo $cfg_zipcode; ?>   版权所有:<?php echo $cfg_copyright; ?> <br />
          <?php echo $cfg_icp; ?></td>

<?php echo ReStrLen($row[‘title‘],10); ?>

<?php echo $row[‘title‘]; ?>
<!-- 获取年月日时间 -->
<?php echo GetDateMk($row[‘posttime‘]); ?>
<!-- 获取年月日时间 -->
<?=MyDate("Y-m-d H:i:s",$row[‘posttime‘]);?>

(classid=$cid OR parentstr LIKE ‘%,$cid,%‘)
<!-- 获取栏目标题 -->
<?php echo GetCatName($cid); ?>
<!-- 获取分页信息 -->
<?php echo $dopage->GetList(); ?>

<!-- 获取合同号 -->
<?php echo microtime_format("YmdHisx",ExecTime())?>

<?php echo ReStrLen($row[‘description‘],34); ?><!--摘要-->

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"><!--手机版自动适应-->
<!-- 获取碎片信息
@param   $id   int  碎片ID
@param   $t    int  调用的内容 0为内容 1为标识名称 2为缩略图 3为跳转连接
-->
<?=GetFragment(2,2);?>
<!-- 获取配置文件信息 -->
<?php echo $cfg_copyright ?>
 if($(‘#checkbox‘).attr(‘checked‘) != ‘checked‘){...}

<!-- 自动携带ID-->
<?
$cid = empty($cid) ? 9 : intval($cid);
error_reporting(0);//屏蔽notice错误
?>


    <!-- 导航栏 -->
    <?php
    $sql = "SELECT * FROM `#@__infoclass` WHERE parentid=5   AND checkinfo=true ORDER BY orderid ASC";
    $dopage->GetPage($sql,9);
    while($row = $dosql->GetArray())
    {
    ?>

          <li >
    <h5><span></span><a href="product.php?cid=<?php echo $row[‘id‘]; ?>" title="<?php echo $row[‘classname‘]?>"><?php echo $row[‘classname‘]?></a></h5>
    <div class="isClassTwo" >
        <dl>
      </dl>
    </div>
    </li>
    <?php
    }
    ?>





<!--  -->

//获取缩略图地址
if($row[‘picurl‘]!=‘‘)
    $picurl = $row[‘picurl‘];
else
    $picurl = ‘templates/default/images/nofoundpic.gif‘;
    <!-- 列表页查询 -->
    <?php

    $dopage->GetPage("SELECT * FROM `#@__infolist` WHERE classid=$cid AND delstate=‘‘ AND checkinfo=true ORDER BY orderid DESC",15);
    while($row = $dosql->GetArray())
    {
        if($row[‘linkurl‘]==‘‘ and $cfg_isreurl!=‘Y‘) $gourl = ‘newslistshow.php?cid=‘.$row[‘classid‘].‘&id=‘.$row[‘id‘];
        else if($cfg_isreurl==‘Y‘) $gourl = ‘newslistshow-‘.$row[‘classid‘].‘-‘.$row[‘id‘].‘-1.html‘;
        else $gourl = $row[‘linkurl‘];

        $row2 = $dosql->GetOne("SELECT `classname` FROM `#@__infoclass` WHERE `id`=".$row[‘classid‘]);
        if($cfg_isreurl!=‘Y‘) $gourl2 = ‘news.php?cid=‘.$row[‘classid‘];
        else $gourl2 = ‘news-‘.$row[‘classid‘].‘-1.html‘;
    ?>
    <li><a href="<?php echo $gourl; ?>" title="<?php echo $row[‘title‘]; ?> "><span class="floatleft"><?php echo ReStrLen($row[‘title‘],16); ?></span><span class="floatright"><?php echo GetDateMk($row[‘posttime‘]); ?></span></a></li>
    <?php
    }
    ?>

    <?php
                
        if(!empty($tid))
            $sql = "SELECT * FROM `#@__goods` WHERE (classid=$cid OR parentstr LIKE ‘%,$cid,%‘) AND `typeid`=$tid AND delstate=‘‘ AND checkinfo=true ORDER BY orderid DESC";
        else
            $sql = "SELECT * FROM `#@__goods` WHERE (classid=$cid OR parentstr LIKE ‘%,$cid,%‘) AND delstate=‘‘ AND checkinfo=true ORDER BY orderid DESC";
        $dopage->GetPage($sql,9);
        while($row = $dosql->GetArray())
        {
            if($row[‘picurl‘] != ‘‘) $picurl = $row[‘picurl‘];
            else $picurl = ‘templates/default/images/nofoundpic.gif‘;
            
            if($row[‘linkurl‘]==‘‘ and $cfg_isreurl!=‘Y‘) $gourl = ‘goodsshow.php?cid=‘.$row[‘classid‘].‘&tid=‘.$row[‘typeid‘].‘&id=‘.$row[‘id‘];
            else if($cfg_isreurl==‘Y‘) $gourl = ‘goodsshow-‘.$row[‘classid‘].‘-‘.$row[‘typeid‘].‘-‘.$row[‘id‘].‘-1.html‘;
            else $gourl = $row[‘linkurl‘];
        ?>
        <li> <a href="<?php echo $gourl; ?>" class="img"><img src="<?php echo $picurl; ?>" /></a>
            <div class="info"><a href="<?php echo $gourl; ?>"><?php echo ReStrLen($row[‘title‘],20); ?></a>
                <p><span class="fl">价格 <i class="lt"><?php echo $row[‘marketprice‘]; ?></i><i><?php echo $row[‘salesprice‘]; ?></i></span><span class="fr">浏览<i class="hits"><?php echo $row[‘hits‘]; ?></i></span></p>
            </div>
        </li>
        <?php
        }
        ?>

    <?php
    $dosql->Execute("SELECT * FROM `#@__infoimg` WHERE classid=13 AND delstate=‘‘ AND checkinfo=true ORDER BY orderid DESC LIMIT 0,4");
    while($row = $dosql->GetArray())
    {
        if($row[‘linkurl‘] != ‘‘)$gourl = $row[‘linkurl‘];
        else $gourl = ‘javascript:;‘;
    ?>
    <li><a href="<?php echo $gourl; ?>"><img src="<?php echo $row[‘picurl‘]; ?>" alt="<?php echo $row[‘title‘]; ?>" /></a></li>
    <?php
    }
    ?>
    
    
    
    <?php
    $dosql->Execute("SELECT * FROM `#@__weblink` WHERE classid=1 AND checkinfo=true ORDER BY orderid,id DESC");
    while($row = $dosql->GetArray())
    {
    ?>
    <a href="<?php echo $row[‘linkurl‘]; ?>" target="_blank"><?php echo $row[‘webname‘]; ?></a>
    <?php
    }
    ?>
    
    
    
    
    
    
    
    

/*分页样式*/
.page_info{text-align:center;margin-top:10px;color:#333;}
.page_info span{padding:0 2px;font-weight:bold;}
.page_list{height:24px;line-height:24px;text-align:center;letter-spacing:0;font-family:"Arial Black";font-size:10px;margin-top:20px;}
.page_list a{display:inline-block;color:#898989;border:1px solid #e8e8e8;background:#f8f8f8;text-align:center;padding:0 8px;margin:0 1px;}
.page_list a:hover{color:#fff;border:1px solid #898989;background:#898989;}
.page_list a.on{color:#333;border:1px solid #ccc;background:#E5EDF2;}

/*分页样式*/
.page_info{text-align:center;margin-top:10px;color:#333;}
.page_info span{padding:0 2px;font-weight:bold;}
.page_list{height:24px;line-height:24px;text-align:center;letter-spacing:0;font-family:"Arial Black";font-size:12px;margin-top:20px;}
.page_list a{display:inline-block;color:#898989;border:1px solid #e8e8e8;background:#f8f8f8;text-align:center;padding:0 8px;margin:0 1px;}
.page_list a:hover{color:#fff;border:1px solid #898989;background:#898989;}
.page_list a.on{color:#333;border:1px solid #ccc;background:#E5EDF2;}



        <?php
        $row = $dosql->GetOne("SELECT * FROM `#@__infoclass` WHERE id = $cid AND checkinfo = ‘true‘ ORDER BY orderid ASC");
        if(!empty($row[‘id‘]))
        {
       ?>
       <?php if($row[‘infotype‘] == ‘0‘){?>
          
          <!-- 装饰器样式开始 -->
        
          <p><?php echo Info($cid);?></p>
                     
                    
          <!-- 装饰器样式结束 -->
          
          
          
          <?php }else if($row[‘infotype‘] == ‘1‘){?>
          <!-- 装饰器样式开始 -->
          
            <?php
            $sql = "SELECT * FROM `#@__infolist` WHERE (classid=$cid OR parentstr LIKE ‘%,$cid,%‘) AND delstate=‘‘ AND checkinfo=true ORDER BY orderid DESC";
                $dopage->GetPage($sql,20);
                while($row = $dosql->GetArray())
                {
                    if($row[‘picurl‘] != ‘‘) $picurl = $row[‘picurl‘];
                    else $picurl = ‘templates/default/images/nofoundpic.gif‘;
                    
                    if($row[‘linkurl‘]==‘‘ and $cfg_isreurl!=‘Y‘) $gourl = ‘newsshow.php?cid=‘.$row[‘classid‘].‘&id=‘.$row[‘id‘];
                    else if($cfg_isreurl==‘Y‘) $gourl = ‘newsshow-‘.$row[‘classid‘].‘-‘.$row[‘id‘].‘-1.html‘;
                    else $gourl = $row[‘linkurl‘];
                ?>

        
                      <li class="content column-num1">
                        <div class="pic-module">
                          <div class="pic"> <a href="<?php echo $gourl; ?>" target="_blank"> <img src= "" id= "FrontProducts_list01-1443145223139_70" alt= "" onerror= "this.src=‘/images/common/noimage.jpg‘" /></a> </div>
                          <span class="lab"> </span> </div>
                        <div class="pro-module">
                          <ul class="basic">
                            <li class="code">
                              <h1> <span>名称:</span>
                              <strong> <a href="<?php echo $gourl; ?>" target="_blank"> <?php echo ReStrLen($row[‘title‘],30); ?></a> </strong>
                              </h1>
                            </li>
                          </ul>
                          <p class="buttonP"> </p>
                          <div class="describe htmledit"> <span> 详细介绍:</span> <?php echo ReStrLen(ClearHtml($row[‘content‘]),80); ?></div>
                        </div>
                      </li>
                      <li class="clearBoth"></li>
                      
                       <?php }?>
                      
                      
                      
                      
                  
                        <?php echo $dopage->GetList(); ?>
                      
          <!-- 装饰器样式结束 -->
          
          
          
          <?php }else if($row[‘infotype‘] == ‘2‘){?>
          <!-- 装饰器样式开始 -->
         
                    <?php
                $sql = "SELECT * FROM `#@__infoimg` WHERE (classid=$cid OR parentstr LIKE ‘%,$cid,%‘) AND delstate=‘‘ AND checkinfo=true ORDER BY orderid DESC";
                $dopage->GetPage($sql,12);
                while($row = $dosql->GetArray())
                {
                    if($row[‘picurl‘] != ‘‘) $picurl = $row[‘picurl‘];
                    else $picurl = ‘templates/default/images/nofoundpic.gif‘;
                    
                    if($row[‘linkurl‘]==‘‘ and $cfg_isreurl!=‘Y‘) $gourl = ‘newsshow.php?cid=‘.$row[‘classid‘].‘&id=‘.$row[‘id‘];
                    else if($cfg_isreurl==‘Y‘) $gourl = ‘newsshow-‘.$row[‘classid‘].‘-‘.$row[‘id‘].‘-1.html‘;
                    else $gourl = $row[‘linkurl‘];
                ?>

                    
                      <li class="content column-num3">
                        <div class="pic-module">
                          <div class="pic"> <a href="<?php echo $gourl; ?>" target="_blank"> <img src= "<?php echo $picurl; ?>" id= "FrontProducts_list01-1443142589760_31" alt= "" onerror= "this.src=‘/images/common/noimage.jpg‘" /></a> </div>
                        </div>
                        <div class="pro-module">
                          <ul class="basic">
                            <li class="code">
                              <h1> <span>名称:</span>
                              <strong> <a href="<?php echo $gourl; ?>" target="_blank"> <?php echo ReStrLen($row[‘title‘],10); ?></a> </strong> </h1>
                            </li>
                          </ul>
                          <p class="buttonP"> </p>
                        </div>
                      </li>
          <?php
          }
         ?>
                      
                     
                    
                        <?php echo $dopage->GetList(); ?>
                  
          <!-- 装饰器样式结束 -->
          
          
          
            <?php }} ?>






<!-- 计数器 示例
 -->
<?php
              $sql = "SELECT * FROM `#@__infoimg` WHERE classid=47 AND checkinfo=true ORDER BY orderid desc";
              $dopage->GetPage($sql,6);
              $i=0;
              while($row = $dosql->GetArray())
              {
              $i++;
              //var_dump($row);
              ?>


        <li  index=<?php echo $i; ?> > <img width="385" height="260" src="<?php echo $row[‘picurl‘] ?>" />



          <div class="txt1">



            <h3><a href="article/detail/id/59.html"><img src="public/tu/tu5.png"></a></h3>



          </div>



        </li>

 <?php } ?>


        <script>
          $(‘li‘).each(function(){
            if($(this).attr(‘index‘)%3 == 0){
              $(this).attr(‘style‘,‘margin-right:0px;‘);
            }
          });
        </script>














<?php    if(!defined(‘IN_PHPMYWIND‘)) exit(‘Request Error!‘);

/*
**************************
(C)2010-2014 lnasp.com
**************************
*/

//数据库服务器
$db_host = ‘121.42.155.24‘;

//数据库用户名
$db_user = ‘demo1‘;

//数据库密码
$db_pwd = ‘gts7890‘;

//数据库名
$db_name = ‘sqldemo1‘;

//数据表前缀
$db_tablepre = ‘pmw_‘;

//数据表编码
$db_charset = ‘utf8‘;

?>





<?php echo ReStrLen($row[‘title‘],30); ?>








//组图
<?php
     $picarr = unserialize($row[‘picarr‘]);
     foreach($picarr as $v)
      {
    $picarrSmall = explode(‘,‘,$v);
      ?>
       <img style="width:350px;height:350px" src="<?php echo $picarrSmall[0]; ?>" class="img-responsive" /></a>
 <?php } ?>




 target="_blank" href="http://wpa.qq.com/msgrd?v=3&amp;uin=<?=GetFragment(15,3);?>&amp;site=qq&amp;menu=yes"



 <?php echo ReStrLen($row[‘title‘],20); ?>















    <?php
            if($rowc[‘infotype‘] == ‘1‘){
                       

        //获取上一篇信息
        $r = $dosql->GetOne("SELECT * FROM `#@__infolist` WHERE classid=".$row[‘classid‘]." AND orderid<".$row[‘orderid‘]." AND delstate=‘‘ AND checkinfo=true ORDER BY orderid DESC");
        if($r < 1)
        {
          echo ‘<div>上一篇:已经没有了</div>‘;
        }
        else
        {
          if($cfg_isreurl != ‘Y‘)
            $gourl = ‘show.php?cid=‘.$row2[‘classid‘].‘&id=‘.$row2[‘id‘];
          else
            $gourl = ‘show-‘.$row2[‘classid‘].‘-‘.$row2[‘id‘].‘-1.html‘;

          echo ‘<div>上一篇:<a href="‘.$gourl.‘">‘.$r[‘title‘].‘</a></div>‘;
        }
        
        //获取下一篇信息
        $r = $dosql->GetOne("SELECT * FROM `#@__infolist` WHERE classid=".$row[‘classid‘]." AND orderid>".$row[‘orderid‘]." AND delstate=‘‘ AND checkinfo=true ORDER BY orderid ASC");
        if($r < 1)
        {
          echo ‘<div>下一篇:已经没有了</div>‘;
        }
        else
        {
          if($cfg_isreurl != ‘Y‘)
            $gourl = ‘show.php?cid=‘.$r[‘classid‘].‘&id=‘.$r[‘id‘];
          else
            $gourl = ‘show-‘.$r[‘classid‘].‘-‘.$r[‘id‘].‘-1.html‘;

          echo ‘<div>下一篇:<a href="‘.$gourl.‘">‘.$r[‘title‘].‘</a></div>‘;
        }
            }else if($rowc[‘infotype‘] == ‘2‘){
                
        //获取上一篇信息
        $r = $dosql->GetOne("SELECT * FROM `#@__infoimg` WHERE classid=".$row[‘classid‘]." AND orderid<".$row[‘orderid‘]." AND delstate=‘‘ AND checkinfo=true ORDER BY orderid DESC");
        if($r < 1)
        {
          echo ‘<li>上一篇:已经没有了</li>‘;
        }
        else
        {
          if($cfg_isreurl != ‘Y‘)
            $gourl = ‘show.php?cid=‘.$r[‘classid‘].‘&id=‘.$r[‘id‘];
          else
            $gourl = ‘show-‘.$r[‘classid‘].‘-‘.$r[‘id‘].‘-1.html‘;

          echo ‘<li>上一篇:<a href="‘.$gourl.‘">‘.$r[‘title‘].‘</a></li>‘;
        }
        
        //获取下一篇信息
        $r = $dosql->GetOne("SELECT * FROM `#@__infoimg` WHERE classid=".$row[‘classid‘]." AND orderid>".$row[‘orderid‘]." AND delstate=‘‘ AND checkinfo=true ORDER BY orderid ASC");
        if($r < 1)
        {
          echo ‘<li>下一篇:已经没有了</li>‘;
        }
        else
        {
          if($cfg_isreurl != ‘Y‘)
            $gourl = ‘show.php?cid=‘.$r[‘classid‘].‘&id=‘.$r[‘id‘];
          else
            $gourl = ‘show-‘.$r[‘classid‘].‘-‘.$r[‘id‘].‘-1.html‘;

          echo ‘<li>下一篇:<a href="‘.$gourl.‘">‘.$r[‘title‘].‘</a></li>‘;
        }
      }
    ?>


                                         <?php
        //判断显示缩略图或组图
        if(!empty($row[‘picarr‘]))
        {
          $picarr = unserialize($row[‘picarr‘]);
          $picarrBig = explode(‘,‘,$picarr[0]);
        ?>
    <?php
    $i=1;
       foreach($picarr as $v)
            {
              $picarrSmall = explode(‘,‘,$v);
              //var_dump($picarrSmall);
      ?>
                    <li <?php if($i==1){echo ‘style="filter: 100; opacity: 1;"‘;} ?>><img src="<?php echo $picarrSmall[0]; ?>"></li>
                    <?php $i++;}} ?>

/*
 * 函数说明:栏目缩略图调用
 *
 * @access  public
 * @param   $classid  int     类别ID
 * @return            string  返回单页缩略图地址
 */
function ClassPic($cid=0)
{
    global $dosql;
    
    $r = $dosql->GetOne("SELECT `picurl` FROM `#@__infoclass` WHERE `id`=$cid");
    if(isset($r) && is_array($r))
    {
        return $r[‘picurl‘];
    }
}


/*
 * 函数说明:获取当前文章名称
 *
 * @access  public
 * @param   $cid  int  栏目id
 * @return  string     返回栏目名称
 */
function GetListName($id=0)
{
    global $dosql;

    $r = $dosql->GetOne("SELECT `title` FROM `#@__infolist` WHERE `id`=$id");

    if(isset($r[‘title‘]))
        return $r[‘title‘];
    else
        return ‘‘;
}



/*
 * 函数说明:获取当前友情链接栏目名称
 *
 * @access  public
 * @param   $cid  int  栏目id
 * @return  string     返回栏目名称
 */
function GetWebName($cid=0)
{
    global $dosql;

    $r = $dosql->GetOne("SELECT `classname` FROM `#@__weblinktype` WHERE `id`=$cid");

    if(isset($r[‘classname‘]))
        return $r[‘classname‘];
    else
        return ‘‘;
}































































































































































































































































































































































































































































































































































































以上是关于php基本语句的主要内容,如果未能解决你的问题,请参考以下文章

php基本语句

用PHP实现基本if和elseif语句

php的基本语法

php流程控制语句

mysql的一些基本操作语句

3 php基本语法