1
我試過下面的查詢和使用Cake的核心XML類,但我得到的字符串不能被解析爲XML錯誤...CakePHP的XML核心String類不能被解析爲XML
$output = $this->Job->query("
SELECT job.id, job.title, organisation.name, jobsboard.name
FROM job
LEFT JOIN portfolio_job_category pjc ON pjc.job_id = job.id
LEFT JOIN category c ON c.id = pjc.category_id
LEFT JOIN organisation ON organisation.id = job.organisation_id
LEFT JOIN portfolio jobsboard ON jobsboard.id = pjc.portfolio_id
WHERE job.end_date >= DATE(NOW())
AND pjc.portfolio_id = $portfolio
ORDER BY c.id DESC
");
$jobs['jobs_feed'] = $output;
$jobs = Xml::fromArray($jobs);
$jobs = $jobs->asXML();
下面是我的從模型的自定義查詢中輸出數組。
Array
(
[0] => Array
(
[job] => Array
(
[id] => 38459
[title] => UTS: Engineering Research Scholarships in Petroleum Remediation
)
[organisation] => Array
(
[name] => University of Technology Sydney
)
[jobsboard] => Array
(
[name] => Research Jobs
)
)
[1] => Array
(
[job] => Array
(
[id] => 44144
[title] => Associate Lecturer - Clinical Exercise Physiology
)
[organisation] => Array
(
[name] => James Cook University
)
[jobsboard] => Array
(
[name] => Research Jobs
)
)
)
有什麼我可以做的,以解決這個問題?