Home  >  Q&A  >  body text

node.js - Want to use node module querystring in .ejs file

Want to use the node module querystring

in the .ejs file

As the title says, how to use the querystring module in the contact.ejs file

Test Results

仅有的幸福仅有的幸福2618 days ago520

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 13:40:07

    console.log 没反应是因为你这是生成后的代码,是在 HTML 里运行的。ejs 里运行的 JavaScript 都必须包起来。

    不知道你是要在 ejs 里运行还是在生成的 HTML 里运行。

    如果是 ejs :

    <% var querystring = require('querystring'); %>
    <%= querystring('...') %>

    如果是 HTML 则按照平时写 JavaScript 的方式使用。要么放服务器通过链接引入要么打包成 bundle 引入。

    reply
    0
  • Cancelreply