为什么他们会像这样在一行写composer.json?

时间:2012-12-06 20:26:58

标签: composer-php

不确定我是否理解使用前向和后向斜杠在一行中编写.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"}}   

1 个答案:

答案 0 :(得分:1)

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

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