微信小程序后端cms怎么开发

作者:小飞燕 发布时间:2021-04-19 09:53:07

导语本文整理了全网深受用户关注的个微信小程序后端cms怎么开发经验知识,可以帮助您全面了解代理怎么做,小白也能成为高手,跟随小编一起来看一看吧!

微信小程序后端cms怎么开发?如何开发小程序cms?下面是如何开发小编编译的微信小程序后端cms系统。有需要的家长可以跟着小编看看如何开发微信小程序的后端cms。

微信小程序后端cms怎么开发?

小程序和应用共享一套api接口,便于相互移植。拒绝所有虚假数据,并提供外部网络api接口。外网接口的地址在小程序源代码的配置文件中,帮助你构建一个可以满足在线标准的cms小程序。

技术点太多,题目只能说明一些知识点。在此基础上,小程序项目类型都可以扩展。微信小程序后端cms系统怎么开发?

1.服务器使用需要php mysql环境的开源项目wordpress,将服务器目录中的文件复制到虚拟主机,修改wp-config.php的数据库配置信息,将server/sql目录中的sql文件中的域名批量替换为您的域名,并将它们导入数据库。背景地址:你的域名/wp-login.php,初始用户:admin,密码:admin

2.小程序服务器需要使用https,本地开发可以使用ngrok:参考配置

3.克隆此项目-;在微信开发工具中添加项目-;在项目中选择应用程序目录

4.将app.js中的serverurl修改为你的域名,然后根据applet开发文档配置其余相关内容,就可以看到完整的程序了

微信小程序如何在cms中显示html文章?

首先,在cms模板中将html文章转换成json数据,识别图片、文本和换行符,过滤掉样式和标签。这里用的是php的正则表达式函数,$content是cms中的html文章。微信小程序代码如下:

$_arr=preg_split('//i ',$content,-1,preg _ split _ no _ empty | preg _ split _ delim _ capture);

$_r=数组;

foreach($_arr as $_txt) {

if(substr($_txt,0,4)='

$ _ matchs=array

preg_match('/

$ _ txt=$ _ matches[1];

if(preg_match('/^//',$_txt)) $_txt=$gupload。$ _ txt

$_r[]=数组(' type '=;img ',' data '=;$ _ txt);

}else {

$_txt=preg_replace('/。*?/'、' '、$ _ txt);

$_txt=preg_replace('/s /',' ',$ _ txt);

$_txt=preg_replace(array('//i ','//i ','//i ','//i ','//i ','//i ','//i '),',$ _ txt);

$_txt=preg_replace('/。*?/'、''、$ _ txt);

$_r[]=数组(' type '=;txt ',' data '=;$ _ txt);

}

}

$ _ data=array(' title '=;$title,' info '=;$inputtime,' content '=;$ _ r);

echo json _ encode($ _ data);

当小程序显示文章时,它请求cms生成的json数据,并通过循环和模板显示文章的内容。{{content}}是cms模板输出的applet的json数据,是由段落或图片数据组成的数组。

谢谢你耐心的阅读。以上是小编编写的微信小程序后端cms系统如何开发的相关内容。希望上面小编编的内容能解决你的问题。更多相关微信小程序可在源代理网络的小程序频道上获得。

下面是题目的开头。微信小程序调用扫开发代码。标题到此结束

扫微信小程序自推出以来一直受到大众的青睐,因为它和扫支付宝一样方便!小编带来的是微信小程序调用,扫开发代码。

第一步:设置拨打微信js的安全域名

第二步:在需要调用微信扫描的页面上附上以下js,前提是需要介绍微信的js[]

第三步:后台获取特征码:

package com . epoch . wap.common;

导入java . io . io exception;

import java . io . unsupportedencodinegexception;

导入java . security . message digest;

导入java . security . nosuchalgorithm exception;

导入java . util . formatter;

导入java . util . hashmap;

导入java . util . map;

导入java . util . uuid;

import org . apache . http . httpresponse;

import org . apache . http . client . clientprotocoleexception;

import org . apache . http . client . methods . httpget;

import org . apache . http . impl . client . httpclients;

import org . apache . http . util . entityutils;

import com . epoch.common . utils . jsonutil;

/**

*使用js的验证工具

* @作者管理员

*

*/

公共类jssignutil {

公共静态字符串访问令牌=null

公共静态地图符号(字符串url) {

字符串发送网址='https://api.weixin.qq.com/cgi-bin/token?grant _ type=client _ credential appid=* * appid * * secret=* * secret * * ';

string result=gethttpresslt(发送url);

对象访问结果=jsonutil。getvaluefromjson(结果,“access _ token”);

字符串签名网址='https://api.weixin.qq.com/cgi-bin/ticket/getticket?access _ token='访问结果。tostring ' type=jsapi

string result sign=gethttprult(sign url);

object ticket=jsonutil。getvaluefromson(结果符号,“ticket”);

map ret=新模拟

string nonce _ str=create _ nonce _ str;

string timestamp=create _ timestamp;

string1

字符串签名=' ';

//注意这里参数名必须全部小写,且必须有序

string1='jsapi_ticket=' ticket

noncestr=' nonce _ str

tamp='时间戳

url=' url

尝试

{

消息摘要crypt=消息摘要。getinstance(' sha-1 ');

crypt .重置

地穴。更新(字符串1。getbytes(' utf-8 ');

signature=byte tohex(crypt。文摘);

}

catch(无此类算法异常e)

{

e.printstacktrace

}

catch(unsupportedencodinegexception e)

{

e.printstacktrace

}

ret.put('url ',url);

ret。put(' non crest ',nonce _ str);

ret.put('timestamp ',timestamp);

ret.put('签名,签名);

ret.put('jsapi_ticket ',ticket);

ret.put('appid ',' wx 154 f 74654 ae 04891 ');

浸水使柔软返回;

}

/**

* 随机加密

* @param hash

* @返回

*/

私有静态字符串bytetohex(比较终字节[]哈希){

formatter formatter=new formatter;

对于(字节b :哈希)

{

formatter.format('x',b);

}

字符串结果=格式化程序。tostring

格式化程序. close

返回结果;

}

/*

* 获取访问地址链接返回值

*/

私有静态字符串gethttpresult(字符串url) {

字符串结果=' ';

http get http request=new http get(url);

尝试{

httpresponse httpresponse=httpclients。创建默认值。execute(http请求);

if(http响应。getstatusline。getstatuscode==200){

result=entityutils。tostring(http响应。get实体);

}

} catch(clientprotocoleexception e){

e.printstacktrace

result=e . getmessage。tostring

} catch (ioexception e) {

e.printstacktrace

result=e . getmessage。tostring

}

返回结果;

}

/**

* 产生随机串-由程序自己随机产生

* @返回

*/

公共关系

促进静态字符串create_nonce_str {

返回uuid。randomuuid。tostring

}

/**

* 由程序自己获取当前时间

* @返回

*/

私有静态字符串创建时间戳{

长时间返回。tostring(系统。当前时间毫秒/1000);

}

} 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120202022123124123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120202022123124

文档示例:

参考以下文档获取access_token(有效期7200秒,小程序开发者必须在自己的服务全局缓存access_token):/15/54 ce 45 d8d 30 b 6 bf 6758 f 68 d2 e 95 bc 627。html

用第一步拿到的access_token采用字符串方式请求获得jsapi_ticket(有效期7200秒,开发者必须在自己的服务全局缓存jsapi _ ticket):https://api。微信。qq。com/cgi-bin/ticket/getticket?access _ token=access _ token type=jsapi

四第四步:前台进入页面:`

@请求映射(值='/跳马)

公共字符串跳马(httpservletrequest请求goodsvo货物)引发异常{

字符串' url=request.getrequesturl '?请求。getquerystring。tostring;

map resmap=new hashmap

resmap=jssignutil。符号(url);

请求。set属性(' non crest ',resmap。get(' non crest ');

请求。setattribute(' timestamp ',resmap。get(' timestamp ');

请求。setattribute(' signature ',resmap。get(' signature ');

request.setattribute('appid ',resmap。get(' appid ');

request.setattribute('url ',resmap。get(' url ');

请求。setattribute(' jsapi _ ticket ',resmap。get(' jsapi _ ticket ');

“return”索引/跳马;

}`

以上就是微信小程序调用扫一扫的操作步骤和具体小程序码了,大家在进行开发的时候一定要仔细对照,不能出错,更多相关资料请关注货源代理网小程序频道。

查看全文

猜你喜欢

微商怎么找货源

频道查询入口

微商代理怎么做