隨機sql語句查詢
select * from biao order by rand() ;
--------------------------------------------------
thinkphp 隨機取出sql語句
$model->table('store_wxshare')->order('rand()')->select();
取出config裏面定義的數組
config 配置文件
<?php
return array(
//'配置項'=>'配置值'
'DB_TYPE' => 'mysql', // 數據庫類型
'DB_HOST' => 'localhost', // 服務器地址
'DB_NAME' => 'order', // 數據庫名
'DB_USER' => 'root', // 用戶名
'DB_PWD' => 'root', // 密碼
'DB_PORT' => 3306, // 端口
'DB_PREFIX' => 'tp_', // 數據庫表前綴
'op' => array(1=>'海蔘產品1',
2=>'海蔘產品2',
3=>'海蔘產品3',
4=>'海蔘產品4',
5=>'海蔘產品5'
),
'status' => array(0=>'已發貨',
1=>'未發貨'
)
);
?>
//取出名字爲op的數組
$op = C('op');
$ming =C('shuzu');
//Jquery公共庫路徑
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
//列表中更改時間格式
{$vo.createtime|date="Y-m-d H:i",###}
//預防sql注入
{$vo.name|htmlspecialchars}
//通過時間段查詢數據
$star=strtotime(date("Y-m-d 0:0:0"));
$end=strtotime(date("Y-m-d 23:59:59"));
$data['ctime'] = array('between',array($star,$end));