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做了这个职位解决你的问题?如果是这样,请不要忘记接受它;)谢谢! –