修复一处模版中的小bug

This commit is contained in:
2017-09-18 19:59:33 +08:00
parent f963c2a373
commit b174b07425
3 changed files with 35 additions and 5 deletions

View File

@@ -998,10 +998,10 @@ function send_email($to, $subject, $message) {
}
//实例化模型
function M($name, $type = 'model'){
function M($name, $type = 'model') {
if ($type == 'model') {
return new \app\common\model\Content(strtolower($name));
}elseif ($type == 'form'){
} elseif ($type == 'form') {
return new \app\common\model\DiyForm(strtolower($name));
}
}
@@ -1128,4 +1128,34 @@ function PyFirst($zh) {
}
}
return $ret;
}
/**
* 获取微信操作对象(单例模式)
* @staticvar array $wechat 静态对象缓存对象
* @param type $type 接口名称 ( Card|Custom|Device|Extend|Media|Oauth|Pay|Receive|Script|User )
* @return \Wehcat\WechatReceive 返回接口对接
*/
function &load_wechat($type = '') {
vendor('Wechat.Loader');
static $wechat = array();
$index = md5(strtolower($type));
if (!isset($wechat[$index])) {
$config = \think\Config::get('wechat');
$config['cachepath'] = CACHE_PATH . 'wechat/';
$wechat[$index] = & Wechat\Loader::get($type, $config);
}
return $wechat[$index];
}
if (!function_exists('getallheaders')) {
function getallheaders() {
$headers = [];
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
}

View File

@@ -108,7 +108,7 @@ return array(
'__ADDONS__' => BASE_PATH . '/addons',
'__PUBLIC__' => BASE_PATH . '/public',
),
'wxapp' => array(
'wechat' => array(
'appid'=>'wx4924a63b43e2fc1a',
'appsecret'=>'0821fc43d2305d4b4722a591361df438'
)

View File

@@ -22,12 +22,12 @@
</div>
</div>
{prev id="$info['id']" cate="$info['category_id']" model="article"}
<a href="{:url('index/content/detail',array('id'=>$prev['id'],'model_id'=>$prev['model_id']))}" class="prev">
<a href="{:url('index/content/detail',array('id'=>$prev['id'],'mdoel'=>'article'))}" class="prev">
<i class="fa fa-angle-left"></i>
</a>
{/prev}
{next id="$info['id']" cate="$info['category_id']" model="article"}
<a href="{:url('index/content/detail',array('id'=>$next['id'],'model_id'=>$next['model_id']))}" class="next">
<a href="{:url('index/content/detail',array('id'=>$next['id'],'mdoel'=>'article'))}" class="next">
<i class="fa fa-angle-right"></i>
</a>
{/next}