phpcms 二次开发注意事项和技巧

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>myweb</title>
    <link rel="stylesheet" href="{BS_PATH}css/bootstrap.min.css">
    <script src="{JS_PATH}jquery.min.js"></script>
    <script src="{BS_PATH}js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="../../../../statics/bs/css/bootstrap.css">
    <script src="../../../../statics/bs/js/jquery-3.2.1.js"></script>
    <script src="../../../../statics/js/jquery.min.js"></script>

</head>
<body>
<div class="container">

    测试取数据
    <table class="table table-bordered">
        <tr>
            <th>ID</th>
            <th>username</th>
            <th>age</th>
            <th>height</th>
        </tr>
        {pc:get sql="select * from v9_userinfo" $num="4" page="$_GET[page]"}
        {loop $data $key $value}
        <tr>
            <td>{$value[id]}</td>
            <td>{$value[username]}</td>
            <td>{$value[age]}</td>
            <td>{$value[height]}</td>
        </tr>
        {/loop}
        {/pc}
    </table>
    <span>{$pages}</span>

    测试loop
    {php $i=0}
    {loop $arr $k $val}
    {if $i%2 == 0}
    <h1 style="background: #cccccc">{$k}---{$val}</h1>
    {else}
    <h1>{$k}---{$val}</h1>
    {/if}
    {php $i++}
    {/loop}

    {loop $arr $k $val}
    {if $n%2 == 0}
    <h1 style="background: #cccccc">{$k}---{$val}---{$n}</h1>
    {else}
    <h1>{$k}---{$val}---{$n}</h1>
    {/if}
    {/loop}


    <!--常用常量-->
    <h1>{HTTP_REFERER}---来源</h1>
    <h1>{SYS_START_TIME}----系统开始时间</h1>
    <h1>{CHARSET}----页面字符集</h1>
    <h1>{SYS_TIME}----当前时间戳</h1>
    <h1>{WEB_PATH}----网站跟路径</h1>
    <h1>{JS_PATH}----JS路径</h1>
    <h1>{BS_PATH}----Bootsrtap路径</h1>
    <h1>{CSS_PATH}----CSS路径</h1>
    <h1>{IMG_PATH}----图片路径</h1>
    <h1>{APP_PATH}----动态程序路径</h1>
    <h1>{PLUGIN_STATICS_PATH}----应用静态文件路径</h1>

</div>
</body>
</html>

 

做数据库的增删改查的时候要将 pc_hash一起传过去,做一个安全性检查;

phpcms封装了很多方法,在model.class.php中,可以直接使用

 

posted @ 2017-09-11 21:46  初心莫负  阅读(88)  评论(0)    收藏  举报