【发布时间】:2018-06-26 12:06:54
【问题描述】:
我得到了这个文件..My list of arrays
我需要填充到 db 中的字段(类型和数据字段)。我将所有数组对象作为字符串返回的一个字段(数据)。还有另一种(类型)我需要返回卡授权、卡财务等。
这是我的数据库。
我的函数正在填充数据字段,但我不知道如何填充我提到的类型字段。
这是我的代码..
public function serializeTransactions()
{
$xml = simplexml_load_file("/var/www/html/web/uploads/gps-trans.xml");
$response = json_decode(json_encode((array)$xml), true);
foreach ($xml as $result) {
$result = (array)$result;
$gps = new Transactions();
$gps->setType();
$gps->setData(json_encode($result));
$this->em->persist($gps);
};
$this->em->flush();
}
对不起,如果我的英语不是那么好,我真的需要一些帮助。
【问题讨论】:
-
很抱歉,您的问题是什么?您的代码是否无法正常工作?是怎么回事?
-
$gps->setType();我需要用卡授权、卡财务等填充该字段。 (见图).. 其他字段工作正常。
标签: php arrays database symfony