【发布时间】:2016-07-11 05:48:49
【问题描述】:
我在 url 中有一个 XML 文件。我想从 xml 中解析数据并为我的实体补充水分。
我已经编写了代码(爬虫),但这不起作用(空响应)。
public function getUsersAction(Request $request)
{
$crawler = new Crawler();
$crawler->addXmlContent(
file_get_contents(
'http://localhost/myproject/web/feed-users.xml'
)
);
json_encode($crawler);
return new JsonResponse(
array(
'crawler' => $crawler
)
);
}
谢谢
【问题讨论】: