`PHP`文件中設置
~~~
//分享設置
$shareCon = array(
'title' => '分享標題',
'desc' => '分享描述',
'imgUrl' => __DIR__ . '/../../img/share_img.jpg',
);
$signPackage = $_W['account']['jssdkconfig'];
~~~
前端或模版文件中加入
~~~
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
~~~
同時在前端中加入對應的`javascript`代碼塊
~~~
<script>
wx.config({
debug: false,
appId: '{$signPackage["appId"]}',
timestamp: '{$signPackage["timestamp"]}',
nonceStr: '{$signPackage["nonceStr"]}',
signature: '{$signPackage["signature"]}',
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'onMenuShareQZone'
]
});
wx.ready(function(){
// 分享朋友圈
wx.onMenuShareTimeline({
title:'{$shareCon["title"]}',
link:window.location.href,
imgUrl:'{php echo tomedia($shareCon["imgUrl"]);}',
success:function(){
//發送成功的方法
// alert('已分享');
},
cancel:function(){
//發送取消的方法
// alert('已取消');
}
});
// 分享給朋友
wx.onMenuShareAppMessage({
title:'{$shareCon["title"]}',
desc:'{$shareCon["desc"]}',
link:window.location.href,
imgUrl:'{php echo tomedia($shareCon["imgUrl"]);}',
success:function(){
//發送成功的方法
// alert('已分享');
},
cancel:function(){
//發送取消的方法
// alert('已取消');
}
});
})
</script>
~~~
- 微擎框架
- 目錄結構
- 配置選項
- 數據庫配置($config[db])
- 系統COOKIE配置項($config[cookie])
- 系統設置($config[setting])
- 預定義常量
- 全局變量
- 全局配置
- 系統配置
- 公眾號相關
- Web 端可見
- App 端可見
- 網頁授權
- URL 路由
- url生成助手
- createMobileUrl
- createWebUrl
- 文件加載器
- func(加載公共函數)
- class(加載公共類)
- model(加載系統model函數)
- web(加載web端公共函數)
- app(加載app端公共函數)
- library(庫文件加載)
- object(實例化加載)
- singleton(單例加載)
- 緩存機制
- cache_write
- cache_load
- cache_delete
- cache_clean
- cache_system_key
- 數據庫
- SQL注入安全
- 連接其它數據庫
- 函數列表
- pdo_get
- pdo_getcolumn
- pdo_getall
- pdo_getslice
- pdo_fetch
- pdo_fetchcolumn
- pdo_fetchall
- pdo_insert
- pdo_update
- pdo_delete
- pdo_query
- pdo_run
- pdo_fieldexists
- pdo_indexexists
- pdo_tableexists
- pdo_fieldmatch
- pdo_debug
- 鏈式查詢
- from
- select
- where
- whereor
- having
- groupby
- orderby
- leftjoin
- innerjoin
- on
- limit
- page
- get
- getall
- getcolumn
- count
- exists
- getLastQueryTotal
- getLastQuery
- 錯誤處理
- 日志記錄
- 模板引擎
- 模板標簽
- 輸出變量
- 判斷語句
- 循環語句
- php語句
- 引用模板
- 創建URL
- 轉義附件URL
- 輸出花括號
- 數據調用
- 調用微站導航
- 調用幻燈片
- 調用文章列表
- 調用分類列表
- 調用快捷菜單
- 常用變量
- 附錄
- 數據庫字典
- 自定義分享