0

不确定我是否理解在这样的单行中使用正斜杠和反斜杠编写 .json 配置的意义?:

{"name":"zendframework\/zendservice-twitter","description":"OOP wrapper for the Twitter web service","type":"library","keywords":["zf2","twitter"],"homepage":"http:\/\/packages.zendframework.com\/","license":"BSD-3-Clause","autoload":{"psr-0":{"ZendService":"library\/"}},"repositories":[{"type":"composer","url":"http:\/\/packages.zendframework.com\/"}],"require":{"php":">=5.3.3","zendframework\/zend-http":">=2.0.0","zendframework\/zend-uri":">=2.0.0","zendframework\/zend-version":">=2.0.0"},"extra":{"branch-alias":{"dev-master":"2.0.x-dev"}},"version":"2.0.1","dist":{"url":"http:\/\/packages.zendframework.com\/composer\/ZendService_Twitter-2.0.1.zip","type":"zip"}}   
4

1 回答 1

1

反斜杠\是转义字符,所以每次看到\/时,/都会被转义。

整个对象写在一行上这一事实很可能是生成 JSON 的任何东西的产物(我假设它不是手写的)。

于 2012-12-06T20:30:17.617 回答