【php】RabbitMQ+supervisord+php消息队列

Continue Read..
CentOS7安装RabbitMQ

由于rabbitmq是基于erlang语言开发的,所以必须先安装erlang。
安装依赖
yum -y install gcc glibc-devel make ncurses-devel openssl-devel xmlto perl wget gtk2-devel binutils-devel

erlang官网:

https://www.erlang.org/downloads

下载(会比较慢,请耐心等待)

wget http://erlang.org/download/otp_src_22.0.tar.gz

移走

mv otp_src_22.0 /usr/local/

切换目录

cd /usr/local/otp_src_22.0/
 

创建即将安装的目录

mkdir ../erlang
 

配置安装路径

./configure --prefix=/usr/local/erlang

如果遇到这个错 你就假装没看到

点击查看原图
安装

make install

 

查看一下是否安装成功

ll /usr/local/erlang/bin
 

添加环境变量

echo 'export PATH=$PATH:/usr/local/erlang/bin' >> /etc/profile
 

刷新环境变量

source /etc/profile
 

甩一条命令

erl
 
点击查看原图
瞬间进入了一个未知的世界

在里面输入halt().命令退出来(那个点号别忘记)

点击查看原图



安装RabbitMQ
rabbitmq下载地址:

https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.7.15

 

下载

wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.15/rabbitmq-server-generic-unix-3.7.15.tar.xz
 

由于是tar.xz格式的所以需要用到xz,没有的话就先安装 

yum install -y xz
 

第一次解压

/bin/xz -d rabbitmq-server-generic-unix-3.7.15.tar.xz
 

第二次解压

tar -xvf rabbitmq-server-generic-unix-3.7.15.tar
 

移走

mv rabbitmq_server-3.7.15/ /usr/local/
 

改名

mv /usr/local/rabbitmq_server-3.7.15  rabbitmq
 

配置环境变量

echo 'export PATH=$PATH:/usr/local/rabbitmq/sbin' >> /etc/profile
 

刷新环境变量

source /etc/profile
 

创建配置目录

mkdir /etc/rabbitmq
 

回到顶部
启动命令
启动:

rabbitmq-server -detached
 

停止:

rabbitmqctl stop
 

状态:

rabbitmqctl status
 

防火墙之类的请自行处理(5672和15672端口),反正我是从来不开防火墙。

 

回到顶部
WEB管理
开启web插件

rabbitmq-plugins enable rabbitmq_management
 

访问:http://127.0.0.1:15672/
点击查看原图 

默认账号密码:guest guest(这个账号只允许本机访问)

 

回到顶部
用户管理
查看所有用户

rabbitmqctl list_users
 

添加一个用户

rabbitmqctl add_user admin 123456
 

配置权限

rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
 

查看用户权限

rabbitmqctl list_user_permissions admin
 

设置tag

rabbitmqctl set_user_tags admin administrator
 

删除用户(安全起见,删除默认用户)

rabbitmqctl delete_user guest
 

回到顶部
登陆
配置好用户之后重启一下rabbit

然后就可以用新账号进行登陆

点击查看原图

 

 

安装supervisord

yum install epel-release

yum install -y supervisor

 

#yum -y install python-setuptools zlib

easy_install supervisor

echo_supervisord_conf > /etc/supervisord.conf

 

mkdir -p /data/etc/supervisord/

mkdir -p /data2/logs/supervisord/

chmod 777 /data2/logs/supervisord/

 

修改 /etc/supervisord.conf

sed -i -e "s#logfile=/tmp/supervisord.log#logfile=/data2/logs/supervisord/supervisord.log#g" /etc/supervisord.conf

sed -i -e "s#file=/tmp/supervisor.sock#file=/var/run/supervisor.sock#g" /etc/supervisord.conf

sed -i -e "s#pidfile=/tmp/supervisord.pid#pidfile=/var/run/supervisord.pid#g" /etc/supervisord.conf

sed -i -e "s#serverurl=unix:///tmp/supervisor.sock#serverurl=unix:///var/run/supervisor.sock#g" /etc/supervisord.conf

echo "[include]" >> /etc/supervisord.conf

echo "files = /data/www/supervisord/*.ini" >> /etc/supervisord.conf

 

 

 

操作脚本:

vi /usr/lib/systemd/system/supervisord.service

 

#输入下面内容,并保存

[Unit]

Description=Supervisord

After=network.target

 

[Service]

Type=forking

PIDFile=/var/run/supervisord.pid

ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf

ExecStop=/bin/kill -TERM $MAINPID

ExecReload=/bin/kill -HUP $MAINPID

Restart=always

 

[Install]

WantedBy=multi-user.target

保存

 

#修改权限

chmod +x /usr/lib/systemd/system/supervisord.service

 

systemctl enable supervisord.service

启用:systemctl start supervisord

 

#其它控制命令

systemctl stop supervisord

systemctl reload supervisord

 

查看进程列表:

systemctl status supervisord

#supervisorctl status

停止进程 mq_test_worker:

supervisorctl stop mq_test_worker:

开始进程 mq_test_worker::

supervisorctl start mq_test_worker:

 

 

启动程序如果提示:Starting supervisor: Error: Another program is already listening on a port that one of our HTTP servers is configured to use.  Shut this program down first before starting supervisord.

unlink /var/run/supervisor.sock

 

 

 

sudo chmod 777 /run

sudo chmod 777 /var/log

sudo touch /var/run/supervisor.sock

sudo chmod 777 /var/run/supervisor.sock

supervisord -c /etc/supervisord.conf

ps aux | grep supervisord

 

 

 

最后效果

supervisord -c /etc/supervisord.conf 开启supervisord服务

supervisorctl start mq_test_worker 开启需要常驻的脚本服务

执行脚本test.php

然后tail -f mq_test_worker.log 里面可以看到队列的数据

 

点击查看原图

 

 

代码附件 : msg_broker.zip

 

 参考网站

RabbitMQ:https://www.cnblogs.com/fengyumeng/p/11133924.html

supervisord(碰到的坑):

https://www.missshi.cn/api/view/blog/5aafcf405b925d681e000000

https://www.cnblogs.com/ruanraun/p/supervisor.html

https://blog.csdn.net/weixin_41762173/article/details/88901970

 

声明:此文系舞林cuznwww.wulinlw.org)原创稿件,转载请保留版权

【小程序】小程序页面定位(类似html锚点)

Continue Read..
goTo:function (id) {
        const q =wx.createSelectorQuery();
        q.select("#"+id).boundingClientRect();
        q.selectViewport().scrollOffset();
        q.exec((res)=>{
            if(res[0] && res[1]){
                console.log("跳转",res[0].top+res[1].scrollTop);
                wx.pageScrollTo({
                    scrollTop:res[0].top+res[1].scrollTop -100,
                    duration:300
                })
            }
        })
    },
    setToView:function (room_id, bed_id) {
        var toView = 'room_bed_'+ room_id + '_' + bed_id;
        console.log("toView===", toView);

        this.setData({
            toView: toView
        });
        var self = this;
        setTimeout(function () {
            console.log("self.data.toView===", self.data.toView);
            self.goTo(self.data.toView);
        }, 1000);

    }


声明:此文系舞林cuznwww.wulinlw.org)原创稿件,转载请保留版权

【php】win修改php-cgi.exe启动接口

Continue Read..
1、先要运行起php的cgi,由于本人用的win7系统,所以cmd先进的c盘(之前全扔c盘这就简单了~),访问到php路径中,输入
php-cgi.exe -b 127.0.0.1:9000
注意这里的-b 127.0.0.1:9000是指定cgi的监听端口,与上文中的Nginx配置要一致,如果有其他配置不记得之前php-cgi是那个端口,可以使用php-cgi.exe -h命令来查看配置(查看-b 后面的<address:port>)。想要查看所有被监听的端口则输入netstat -na

声明:此文系舞林cuznwww.wulinlw.org)原创稿件,转载请保留版权

【go】操作数据库

Continue Read..

目录结构

点击查看原图

 

@GOPATH

点击查看原图

 

 

CREATE TABLE `userinfo` (

  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,

  `name` varchar(20) NOT NULL DEFAULT '',

  `uid` int(10) unsigned NOT NULL DEFAULT '0',

  PRIMARY KEY (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8


 

1.go

package main
 
import (
	"conf"
	"fmt"
	// 或者
	// myDbConf "conf"
)
 
func main() {
	opend, db := conf.OpenDB()
	//opend, db := myDbConf.OpenDB()
 
	fmt.Println(db)
	if opend {
		fmt.Println("open success")
	} else {
		fmt.Println("open faile:")
	}
	// DeleteFromDB(db, 10)
	//QueryFromDB(db)
	//DeleteFromDB(db, 1)
	//UpdateDB(db, 5)
	conf.InsertToDB(db)
	//myDbConf.InsertToDB(db)
 
	//UpdateUID(db, 5)T
	//UpdateTime(db, 4)
 
}

 
 
 
dbConf.go
package dbConf
 
import (
	"crypto/md5"
	"database/sql"
	"encoding/hex"
	"fmt"
	"strconv"
	"time"
 
	_ "github.com/go-sql-driver/mysql"
)
 
const (
	DB_Driver = "root:root@tcp(127.0.0.1:3306)/test?charset=utf8"
)
 
func OpenDB() (success bool, db *sql.DB) {
	var isOpen bool
	db, err := sql.Open("mysql", DB_Driver)
	// fmt.Println(db)
	if err != nil {
		isOpen = false
	} else {
		isOpen = true
	}
	CheckErr(err)
	return isOpen, db
}
 
func InsertToDB(db *sql.DB) {
	uid := GetNowtimeMD5()
	// nowTimeStr := GetTime()
	stmt, err := db.Prepare("insert userinfo set name=?,uid=?")
	CheckErr(err)
	res, err := stmt.Exec("wangbiao", uid)
	CheckErr(err)
	id, err := res.LastInsertId()
	CheckErr(err)
	if err != nil {
		fmt.Println("插入数据失败")
	} else {
		fmt.Println("插入数据成功:", id)
	}
}
 
func QueryFromDB(db *sql.DB) {
	rows, err := db.Query("SELECT * FROM userinfo")
	CheckErr(err)
	if err != nil {
		fmt.Println("error:", err)
	} else {
	}
	for rows.Next() {
		var uid string
		var name string
 
		CheckErr(err)
		err = rows.Scan(&uid, &name)
		fmt.Println(name)
		fmt.Println(uid)
	}
}
 
func UpdateDB(db *sql.DB, uid string) {
	stmt, err := db.Prepare("update userinfo set name=? where uid=?")
	CheckErr(err)
	res, err := stmt.Exec("zhangqi", uid)
	affect, err := res.RowsAffected()
	fmt.Println("更新数据:", affect)
	CheckErr(err)
}
func DeleteFromDB(db *sql.DB, id int) {
	stmt, err := db.Prepare("delete from userinfo where id=?")
	CheckErr(err)
	res, err := stmt.Exec(id)
	affect, err := res.RowsAffected()
	fmt.Println("删除数据:", affect)
}
 
func CheckErr(err error) {
	if err != nil {
		panic(err)
		fmt.Println("err:", err)
	}
}
 
func GetTime() string {
	const shortForm = "2006-01-02 15:04:05"
	t := time.Now()
	temp := time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), time.Local)
	str := temp.Format(shortForm)
	fmt.Println(t)
	return str
}
 
func GetMD5Hash(text string) string {
	haser := md5.New()
	haser.Write([]byte(text))
	return hex.EncodeToString(haser.Sum(nil))
}
 
func GetNowtimeMD5() string {
	t := time.Now()
	timestamp := strconv.FormatInt(t.UTC().UnixNano(), 10)
	return GetMD5Hash(timestamp)
}
 mysql.zip

 

声明:此文系舞林cuznwww.wulinlw.org)原创稿件,转载请保留版权

【php】mysql跨库回滚

Continue Read..
CREATE TABLE afu.`test2` (
  `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(50) DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
CREATE TABLE trade.`test2` (
  `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(50) DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
<?php
/**
 * Created by PhpStorm.
 * User: cuzn
 * Date: 2018/12/28
 * Time: 19:10
 */


namespace app\afu\cron\department;

use app\afu\api\model\afu\Test2Model;
use app\afu\api\model\trade\Test1Model;
use PhpOffice\PhpSpreadsheet\Exception;

require_once __DIR__ . '/../../conf/config.inc.php';

echo "exec at " . date('Y-m-d H:i:s') . "\n";


$Test1Model = Test1Model::getInstance();


function addTest2($isBack = false){
    $Test2Model = Test2Model::getInstance();
    try {
        $Test2Model->begin();
    
        $ret = $Test2Model->insert([
            'name' => 'bbbbbbb'
        ]);
        if (!$isBack) {
            $Test2Model->commit();
            return true;
        } else {
            $Test2Model->rollback();
            return false;
        }
    } catch (Exception $e) {
        $Test2Model->rollback();
        throw $e;
        //return false;
    }
}


try {
    $Test1Model->begin();
    
    $ret = $Test1Model->insert([
        'name' => 'aaaaaa'
    ]);
    $ret2 = addTest2(false);
    var_dump($ret, $ret2);
    if ($ret && $ret2) {
        $Test1Model->commit();
    }else {
        $Test1Model->rollback();
    }
} catch (Exception $e) {
    //addTest2(1);
    $Test1Model->rollback();
    throw $e;
}


声明:此文系舞林cuznwww.wulinlw.org)原创稿件,转载请保留版权

【ajax】jquery.ajax上传文件

Continue Read..

Simple HTML

<input type="file" id="one-specific-file" name="one-specific-file">

Use as little as

$('#one-specific-file').ajaxfileupload({
  action: '/upload.php'
});

or as much as

$('input[type="file"]').ajaxfileupload({
  action: '/upload.php',
  valid_extensions : ['md','csv'],
  params: {
    extra: 'info'
  },
  onComplete: function(response) {
    console.log('custom handler for file:');
    alert(JSON.stringify(response));
  },
  onStart: function() {
    if(weWantedTo) return false; // cancels upload
  },
  onCancel: function() {
    console.log('no file selected');
  }

});

参考网址 https://github.com/jfeldstein/jQuery.AjaxFileUpload.js

jquery.ajaxfileupload.zip

【jquery】单选框选中事件

Continue Read..
$(function(){
$("input[name='level']").click(function(){
console.log(123);
getPriceAndRatio($('input[name="level"]:checked').val(), 0, 0);
});
});

声明:此文系舞林cuznwww.wulinlw.org)原创稿件,转载请保留版权

【JS】计算时间之间的日期

Continue Read..
var endTime = $("#end_date_time").val();//2018-07-20 03:30
endTime = Math.floor(new Date(endTime + ':00').getTime() / 1000);

var nTime = endTime - startTime;
var days =Math.floor(nTime/(24 * 3600));

声明:此文系舞林cuznwww.wulinlw.org)原创稿件,转载请保留版权

【微信小程序】web-view

Continue Read..

微信小程序直接用

<!-- wxml -->

<!-- 指向微信公众平台首页的web-view -->

<web-view src="https://url.com"></web-view>

 

这里面的url的head里面需要加

 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<meta name="renderer" content="webkit">

<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">

 

不然字体会变很小

 

<style>

        .tui-editor-contents img{

            max-width: 100%; !important;

        }

    </style>

 

加这个会让图片铺平

声明:此文系舞林cuznwww.wulinlw.org)原创稿件,转载请保留版权

【tui.editor】使用和修改上传

Continue Read..

 

首先调用这些js css(有些是不需要的,自己删)

 <link href="http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

<script src="http://cdn.bootcss.com/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>

<script>window.jQuery || document.write('<script src="/sta/dist/js/tui-editor/js/jquery-1.11.0.min.js"><\/script>')</script>

<script src="/sta/dist/js/tui-editor/lib/markdown-it/dist/markdown-it.js"></script>

<script src="/sta/dist/js/tui-editor/lib/toMark/dist/toMark.js"></script>

<script src="/sta/dist/js/tui-editor/lib/tui-code-snippet/dist/tui-code-snippet.js"></script>

<script src="/sta/dist/js/tui-editor/lib/tui-color-picker/dist/tui-color-picker.js"></script>

<script src="/sta/dist/js/tui-editor/lib/codemirror/lib/codemirror.js"></script>

<script src="/sta/dist/js/tui-editor/lib/highlightjs/highlight.pack.js"></script>

<script src="/sta/dist/js/tui-editor/lib/squire-rte/build/squire-raw.js"></script>

<link rel="stylesheet" href="/sta/dist/js/tui-editor/lib/codemirror/lib/codemirror.css">

<link rel="stylesheet" href="/sta/dist/js/tui-editor/lib/highlightjs/styles/github.css">

 

<script src="/sta/dist/js/tui-editor/lib/plantuml-encoder/dist/plantuml-encoder.js"></script>

<script src="/sta/dist/js/tui-editor/lib/raphael/raphael.js"></script>

<script src="/sta/dist/js/tui-editor/lib/tui-chart/dist/tui-chart.js"></script>

<script src="/sta/dist/js/tui-editor/dist/tui-editor-Editor-all.js"></script>

<link rel="stylesheet" href="/sta/dist/js/tui-editor/dist/tui-editor.css">

<link rel="stylesheet" href="/sta/dist/js/tui-editor/dist/tui-editor-contents.css">

<link rel="stylesheet" href="/sta/dist/js/tui-editor/lib/tui-color-picker/dist/tui-color-picker.css">

<link rel="stylesheet" href="/sta/dist/js/tui-editor/lib/tui-chart/dist/tui-chart.css">

 

 

我的表单是用from 提交的,大家也可以直接ajax提交表单

 

<form action="/article/<?=$this->ectType?>/" id="id-form" class="form-horizontal form-validate" role="form"

                  method="post" onsubmit="return subF();">

  

                <div class="align-left">

 

                    <div class="form-group">

                        <label class="col-xs-2 control-label no-padding-right">内容</label>

                        <div class="col-xs-9" id="contentEditor"></div>

                        <textarea type="text"  hidden name="content" id="content" class="col-xs-6" rows="6"> </textarea>

                    </div>

     

                </div>

                <div class="clearfix form-actions">

                    <div class="col-md-offset-2 col-md-9">

                        <button class="btn btn-info" type="submit">

                            <i class="ace-icon fa fa-check bigger-110"></i>

                            提交

                        </button>

                    </div>

                </div>

            </form>

 

 

    <script class="code-js">

        var content = [];

        //这里需要注意,php需要传一个json对象过来,

        //$data['content'] = explode("\r\n", $data['content']);

        //$data['content'] = json_encode($data['content']);

 

        content = <?= $this->data['content']; ?>;

        

        //var content = [

        //    '| @cols=2:merged |',

        //    '| --- | --- |',

        //    '| table | table |',

        //    '```uml',

        //    'partition Conductor {',

        //    '  (*) --> "Climbs on Platform"',

        //    '  --> === S1 ===',

        //    '  --> Bows',

        //    '}',

        //    '',

        //    'partition Audience #LightSkyBlue {',

        //    '  === S1 === --> Applauds',

        //    '}',

        //    '',

        //    'partition Conductor {',

        //    '  Bows --> === S2 ===',

        //    '  --> WavesArmes',

        //    '  Applauds --> === S2 ===',

        //    '}',

        //    '',

        //    'partition Orchestra #CCCCEE {',

        //    '  WavesArmes --> Introduction',

        //    '  --> "Play music"',

        //    '}',

        //    '```',

        //    '```chart',

        //    ',category1,category2',

        //    'Jan,21,23',

        //    'Feb,31,17',

        //    '',

        //    'type: column',

        //    'title: Monthly Revenue',

        //    'x.title: Amount',

        //    'y.title: Month',

        //    'y.min: 1',

        //    'y.max: 40',

        //    'y.suffix: $'

        //].join('\n');

 

        var editor = new tui.Editor({

            el: document.querySelector('#contentEditor'),

            previewStyle: 'vertical',

            height: '300px',

            initialEditType: 'wysiwyg',

            useCommandShortcut: true,

            initialValue: content.join('\n'),

            hooks: {

                addImageBlobHook: addImageBlobHook.bind(this),

            },

            exts: ['scrollSync', 'colorSyntax', 'uml', 'chart', 'mark', 'table', 'taskCounter']

        });

        console.log(editor);

 

        function addImageBlobHook(blob, callback) {

 

            const data = new FormData();

            //blob就是一个文件对象

 

点击查看原图

            data.append('upfile', blob);

            //console.log(data, $('#cuzn123')[0]);

 

         //console.log 打印data的时候确实为空,要用下面的方法打印,然后看php获取的值,之前一直用get,拿不到值,换了post就好了

            //console.log(data.has("upfile"));//true

            console.log(data.get("upfile"));

            //data.forEach(function(file){

            //    console.log(file);

            //});

            

            $.ajax({

                url: "/index/upToQiniu/",

                type: "POST",

                data: data,

                //dataType: 'JSON',

                processData: false,

                contentType: false,

                //async: false,

                cache: false,

                //headers: {

                //    'Content-Type': 'multipart/form-data'

                //},

                success: function (result) {

                    result = JSON.parse(result);

                    console.log(typeof result);

                    console.log("result['state'] : " + result["state"]);

                    console.log("result.state : " + result.state);

                    if (result["state"] == 'SUCCESS') {

                        //这里是生成htpp模式的图片地址(我这里是七牛返回的一个key,需要转换)

                        var image = MyCommon.getViewImage(result["key"]);

                        //这里是插件自带的回调函数

                        callback(image, 'alt text');

                    }

                    console.log(result);

                },

                error: function (e) {

                    console.log(e);

                }

            });

            //$.get('/upload-images', data, config) .then(response => { callback(response.data.url, ''); }) .catch(error => { })

        }

        

        //提交表单之前 把值插入textarea 里面

        function subF() {

            $("#content").val(editor.getMarkdown ());

            //console.log('editor.getHtml () : ' + editor.getHtml ());

            //console.log('editor.getValue () : ' + editor.getValue ());

            //console.log('editor.getMarkdown () : ' + editor.getMarkdown ());

            return true;

        }

    </script>

 

 try {

$ret = QiNiu::upload($_FILES["upfile"]["tmp_name"]);

$result = [

'state' => 'SUCCESS',

'key' => $ret,

];

} catch (Exception $e) {

$result = [

'state' => $e->getMessage(),

];

}

echo json_encode($result);

 

 

最后要显示数据库的值需要用Markdown转HTML的插件 showdown

 点击查看原图

<script src="/sta/dist/js/showdown-1.8.6/dist/showdown.js"></script>

<div class="row">

    <div class="col-xs-12" id="content">

    </div>

</div>

 

<!--js:start-->

<script>

 

    //这里的php只需要 $data['content'] = json_encode($data['content']);

 

    var content = '';

    <?php  if (!empty($this->data['content'])) { ?>

    content = <?= $this->data['content']; ?>;

    <?php } ?>

    var converter = new showdown.Converter({

            "omitExtraWLInCodeBlocks":true,

            "noHeaderId":false,

            "prefixHeaderId":"",

            "ghCompatibleHeaderId":true,

            "headerLevelStart":1,

            "parseImgDimensions":true,

            "simplifiedAutoLink":true,

            "excludeTrailingPunctuationFromURLs":false,

            "literalMidWordUnderscores":true,

            "strikethrough":true,

            "tables":true,

            "tablesHeaderId":false,

            "ghCodeBlocks":true,

            "tasklists":true,

            "smoothLivePreview":true,

            "smartIndentationFix":false,

            "disableForced4SpacesIndentedSublists":false,

            "simpleLineBreaks":false,

            "requireSpaceBeforeHeadingText":false,

            "ghMentions":false,"extensions":[],"sanitize":false

        }),

        //text = '# hello, markdown!',

        html = converter.makeHtml(content);

    $("#content").html(html);

</script>

<!--js:end-->

 点击查看原图

 

参考网站

https://qiita.com/dala00/items/93f96dfbf63e71765562  这个是addImageBlobHook使用的,整个google就这个日本鬼子写了这个

 

这个是官方的文档,硬是想打死这个作者

https://nhnent.github.io/tui.editor/api/latest/ToastUIEditor.html#getHtml  

https://github.com/nhnent/tui.editor#-examples

 

showdown 参考网址

https://github.com/showdownjs/showdown

https://blog.csdn.net/yzf913214/article/details/54607897 

 

 

tui-editor.zip showdown-1.8.6.zip

声明:此文系舞林cuznwww.wulinlw.org)原创稿件,转载请保留版权