PHP 读取 MSSQL
程序员文章站
2022-06-04 20:26:19
...
MSSQL 储存的手机 datatime 类型!
array(2622) {
[0]=>
array(28) {
...
["oper_date"]=>
object(DateTime)#2 (3) {
["date"]=>
string(19) "2014-02-28 14:04:37"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Asia/Shanghai"
}
....
}
}
怎么把里面的['date']
区出来?
我这样写的 报错!
$result = $db->table('t_rm_payflow')->select();
foreach($result as $key => $val)
{
echo('');
echo "".$val['flow_no']." ";
echo "".sprintf("%.2f",$val['sale_amount'])." ";
echo "".$val['pay_way']." ";
echo "".$val['oper_id']." ";
echo "".$val['oper_date']->date." ";
echo(' ');
}
我这样就是` $val['oper_date']->date` 取不到报错!
Notice: Undefined property: DateTime::$date in D:\htdocs\php2mssql\index.php on line XX
回复内容:
MSSQL 储存的手机 datatime 类型!
array(2622) {
[0]=>
array(28) {
...
["oper_date"]=>
object(DateTime)#2 (3) {
["date"]=>
string(19) "2014-02-28 14:04:37"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Asia/Shanghai"
}
....
}
}
怎么把里面的['date']
区出来?
我这样写的 报错!
$result = $db->table('t_rm_payflow')->select();
foreach($result as $key => $val)
{
echo('');
echo "".$val['flow_no']." ";
echo "".sprintf("%.2f",$val['sale_amount'])." ";
echo "".$val['pay_way']." ";
echo "".$val['oper_id']." ";
echo "".$val['oper_date']->date." ";
echo(' ');
}
我这样就是` $val['oper_date']->date` 取不到报错!
Notice: Undefined property: DateTime::$date in D:\htdocs\php2mssql\index.php on line XX
那是个对象先取出来oper_date,然后$oper_date->date
上一篇: Ngnix Tcp 代理转发SS服务
下一篇: 图片自动清理程序