2015-10-15 70 views
0

試圖使捲曲命中,這是一樣的東西:我如何發送單引號和特殊字符捲曲

curl -XPOST 'http://localhost:9200/market/products/' -d '{ 
    "description": \"If you and your husband or boyfriend like to wear things that match; and he wears frame model 189812 or 189832; or the Unisex frame models 187821 or 187812; you've got to get this full-rim; round; medium-size; faux-wood; hypoallergenic acetate Women's eyeglasses frame. The male and female versions of these glasses are similar; although these are actually a little bigger than the male model. (We're talking about your guy; so don't start thinking about male models; unless he is one.) One version is brown; the other is purple; and the two of you will look adorable in your matching glasses. If you're single; you won't be for long (if that's your desire); because you'll look adorable in these glasses all by yourself!\"" }' 

現在我的問題是在說明字段中的特殊字符。任何人都可以建議我該怎麼做。

感謝

回答

0

您需要將所有的單引號(即you''ll而不是you'll)翻一番,除去第一個反斜槓在描述字段,就像這樣:

curl -XPOST 'http://localhost:9200/market/products/' -d '{ "description": "If you and your husband or boyfriend like to wear things that match; and he wears frame model 189812 or 189832; or the Unisex frame models 187821 or 187812; you''ve got to get this full-rim; round; medium-size; faux-wood; hypoallergenic acetate Women''s eyeglasses frame. The male and female versions of these glasses are similar; although these are actually a little bigger than the male model. (We''re talking about your guy; so don''t start thinking about male models; unless he is one.) One version is brown; the other is purple; and the two of you will look adorable in your matching glasses. If you''re single; you won''t be for long (if that''s your desire); because you''ll look adorable in these glasses all by yourself!\"" }' 
                      ^
                      | 
                  remove the backslash here 
+0

感謝@val,它的工作 – railsman

+0

真棒,很高興它解決了! – Val