Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php “如何放置数组”;[……”是;括号中的虚张声势和拉雷维尔的评论?_Php_Swagger_Laravel 5.5 - Fatal编程技术网

Php “如何放置数组”;[……”是;括号中的虚张声势和拉雷维尔的评论?

Php “如何放置数组”;[……”是;括号中的虚张声势和拉雷维尔的评论?,php,swagger,laravel-5.5,Php,Swagger,Laravel 5.5,我无法在带有数组括号的示例中编写JSON代码 @SWG\Definition( * definition="UserResponse", * @SWG\Property(property="response", example={ * "id": 1, * "name": "Raj", * "userprofile": [{ * "email"

我无法在带有数组括号的示例中编写JSON代码

@SWG\Definition(
 *      definition="UserResponse",
 *      @SWG\Property(property="response", example={
 *               "id": 1,
 *               "name": "Raj",
 *               "userprofile": [{
 *                    "email": "raj@gmail.com",
 *                    "phone": "9999999999",
 *               }],  
 *               "updated_at": "2017-03-06 12:03:12",
 *               "created_at": "2017-03-06 12:03:12"
 *             }
 *      ),
 * ),
 */
我希望这种输出使用招摇响应输出

{
   "id": 1,
   "name": "Raj",
   "userprofile": [
       {
         "email": "raj@gmail.com",
         "phone": "9999999999",
       }
   ],  
   "updated_at": "2017-03-06 12:03:12",
   "created_at": "2017-03-06 12:03:12"
}
根据以上代码,我需要以下类型的输出: 谢谢,

你只需要添加“{”花键“}”,因此它会考虑数组“[]”括号。

@SWG\Definition(
 *      definition="UserResponse",
 *      @SWG\Property(property="response", example={
 *               "id": 1,
 *               "name": "Raj",
 *               "userprofile": {{
 *                    "email": "raj@gmail.com",
 *                    "phone": "9999999999",
 *               }},  
 *               "updated_at": "2017-03-06 12:03:12",
 *               "created_at": "2017-03-06 12:03:12"
 *             }
 *      ),
 * ),
 */

谢谢你的回答,让我检查一下,让你知道同样的情况。