0
我試圖使用顯示的IMG標籤響應/ xexpr球拍:將字符串變量變成xexpression屬性
這工作:
(define (start req)
(response/xexpr
'(html (head (title "Racket Heroku App"))
(body
(h1 "Hello World!")
(div "it works!!!!")
(img ([src "https://docs.racket-lang.org/pict/pict_196.png"]))))))
這不:
(define example-url "https://docs.racket-lang.org/pict/pict_196.png")
(define (start req)
(response/xexpr
'(html (head (title "Racket Heroku App"))
(body
(h1 "Hello World!")
(div "it works!!!!")
(img ([src example-url]))))))
的顯示的錯誤如下:
response/xexpr: contract violation;
Not an Xexpr. Expected an attribute value string, given 'a
Context:
'(html
(head (title "Racket Heroku App"))
(body
(h1 "Hello World!")
(div "it works!!!!")
(img
((src
'a)))))
我在做什麼錯?
@Arjun做了這個職位解決你的問題?如果是這樣,請不要忘記接受它;)謝謝! –