Tôi đang xem xét một ví dụ về curllệnh sử dụng ký hiệu @ trước tên tệp để đăng dữ liệu lên máy chủ.
curl http://localhost/ --data-binary @file.txt
Điều đó có nghĩa là gì? Nó có chèn nội dung của tập tin vào lệnh không? Có cụ thể curlkhông?
Tôi đang xem xét một ví dụ về curllệnh sử dụng ký hiệu @ trước tên tệp để đăng dữ liệu lên máy chủ.
curl http://localhost/ --data-binary @file.txt
Điều đó có nghĩa là gì? Nó có chèn nội dung của tập tin vào lệnh không? Có cụ thể curlkhông?
Câu trả lời:
Nó là cụ thể để cuộn tròn. Từ man curl:
--data-binary <data>
(HTTP) This posts data exactly as specified with no extra processing whatsoever.
If you start the data with the letter @, the rest should be a filename. Data is
posted in a similar manner as --data-ascii does, except that newlines are preserved
and conversions are never done.
If this option is used several times, the ones following the first will append data
as described in -d, --data.