鍍金池/ 問答/Java  PHP  數(shù)據(jù)庫  HTML/ json 如何匯入 SQL? (quill編輯器)

json 如何匯入 SQL? (quill編輯器)

我用了一個編輯器叫quill

var quill = new Quill('#editor', {
  modules: {
    toolbar: toolbarOptions
  },
  placeholder: 'Compose an epic...',
  theme: 'snow'
});

var form = document.querySelector('form');
form.onsubmit = function() {
  // Populate hidden form on submit
  var content = document.querySelector('input[name=content]');
  content.value = JSON.stringify(quill.getContents());

  console.log("Submitted", $(form).serialize(), $(form).serializeArray());

alert('Open the console to see the submit data!')
  return false;
};

我想把它content的內(nèi)容丟到sql
但是這是json格式。。。

0: {name: "title", value: ""}
1: name: "content"value: "{"ops":[{"insert":"srgsegsrehreshrseh"},{"attributes":{"blockquote":true},"insert":"\n"}]}"__proto__: Object
2: {name: "tag", value: ""}
3: {name: "password", value: ""}length: 4__proto__: Array(0)

我title, tag, password 都是用php的POST去接值然後匯入到SQL
但唯獨content他是直接丟json.....那我要怎麼轉(zhuǎn)換才對?因為我真正需要的是html而不是json,但是找了一下官方改掉getHtml的API。。。。

回答
編輯回答
爆扎

沒人回答就自己回答...已經(jīng)解決!

2017年11月30日 21:10