PHP 读取 MSSQL

WBOY
Libérer: 2016-06-06 20:45:36
original
1624 Les gens l'ont consulté

MSSQL 储存的手机 datatime 类型!

<code>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"
    }
....
}
}
</code>
Copier après la connexion
Copier après la connexion

怎么把里面的['date'] 区出来?

我这样写的 报错!

<code>$result = $db->table('t_rm_payflow')->select();
    foreach($result as $key => $val)
    {
        echo('<tr>');
        echo "<td>".$val['flow_no']."</td>";
        echo "<td>".sprintf("%.2f",$val['sale_amount'])."</td>";
            echo "<td>".$val['pay_way']."</td>";
            echo "<td>".$val['oper_id']."</td>";
            echo "<td>".$val['oper_date']->date."</td>";
            echo('</tr>');
    }

我这样就是` $val['oper_date']->date`  取不到报错!

    Notice: Undefined property: DateTime::$date in D:\htdocs\php2mssql\index.php on line XX
</code>
Copier après la connexion
Copier après la connexion

回复内容:

MSSQL 储存的手机 datatime 类型!

<code>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"
    }
....
}
}
</code>
Copier après la connexion
Copier après la connexion

怎么把里面的['date'] 区出来?

我这样写的 报错!

<code>$result = $db->table('t_rm_payflow')->select();
    foreach($result as $key => $val)
    {
        echo('<tr>');
        echo "<td>".$val['flow_no']."</td>";
        echo "<td>".sprintf("%.2f",$val['sale_amount'])."</td>";
            echo "<td>".$val['pay_way']."</td>";
            echo "<td>".$val['oper_id']."</td>";
            echo "<td>".$val['oper_date']->date."</td>";
            echo('</tr>');
    }

我这样就是` $val['oper_date']->date`  取不到报错!

    Notice: Undefined property: DateTime::$date in D:\htdocs\php2mssql\index.php on line XX
</code>
Copier après la connexion
Copier après la connexion

那是个对象先取出来oper_date,然后$oper_date->date

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!