HTML 中的智能双引号显示:语法错误:意外字符 '“'

问题描述 投票:0回答:1
extends base.pug

block scripts
    script(src='/static/index.js')

block style
  style
      include ../static/style.css
      include ../static/styleContact.css

block content 
    div.container
    h1 Contact Us
    form(action='/contact', method= "post", class= "myForm")
        input(type="text" class= “name” name="name" placeholder="Enter your name")
        input(type="phone" class= “myInput” name="phone" placeholder="Enter your name")
        input(type="email" class= “myInput” name="email" placeholder="Enter your email")
        input(type="text" name="firstname" placeholder="Your name")
        button(class="btn")
          | Submit

此错误显示在我的 chrome 中

Error: E:\Web design & development\4 javascript\Dance website 75\views\contact.pug:15:34
    13|     h1 Contact Us
    14|     form(action='/contact', method= "post", class= "myForm")
  > 15|         input(type="text" class= “name” name="name" placeholder="Enter your name")
-----------------------------------------^
    16|         input(type="phone" class= “myInput” name="phone" placeholder="Enter your name")
    17|         input(type="email" class= “myInput” name="email" placeholder="Enter your email")
    18|         input(type="text" name="firstname" placeholder="Your name")

Syntax Error: Unexpected character '“'
    at makeError (E:\Web design & development\4 javascript\Dance website 75\node_modules\pug-error\index.js:34:13)
    at Lexer.error (E:\Web design & development\4 javascript\Dance website 75\node_modules\pug-lexer\index.js:62:15)
    at Lexer.assertExpression (E:\Web design & development\4 javascript\Dance website 75\node_modules\pug-lexer\index.js:96:12)
    at Lexer.attributeValue (E:\Web design & development\4 javascript\Dance website 75\node_modules\pug-lexer\index.js:1428:10)
    at Lexer.attribute (E:\Web design & development\4 javascript\Dance website 75\node_modules\pug-lexer\index.js:1275:30)
    at Lexer.attrs (E:\Web design & development\4 javascript\Dance website 75\node_modules\pug-lexer\index.js:1454:20)
    at Lexer.callLexerFunction (E:\Web design & development\4 javascript\Dance website 75\node_modules\pug-lexer\index.js:1647:23)
    at Lexer.advance (E:\Web design & development\4 javascript\Dance website 75\node_modules\pug-lexer\index.js:1686:12)
    at Lexer.callLexerFunction (E:\Web design & development\4 javascript\Dance website 75\node_modules\pug-lexer\index.js:1647:23)
    at Lexer.getTokens (E:\Web design & development\4 javascript\Dance website 75\node_modules\pug-lexer\index.js:1706:12)
html pug
1个回答
1
投票

问题是你的引号字符:

“name”
可能LOOK有效,但你需要
"
(ASCII 22),而不是
(ASCII E2)。 “0xe2”是非法的 HTML。

© www.soinside.com 2019 - 2024. All rights reserved.