【问题标题】:"A non well formed numeric value encountered"“遇到格式不正确的数值”
【发布时间】:2019-03-21 11:07:18
【问题描述】:

我正在使用以下代码。

$request->hour= 10:00:00
$parameters->hour=strtotime(date(" H:i:s",$request->hour));

我收到以下错误。

遇到格式不正确的数值

【问题讨论】:

    标签: php laravel datetime


    【解决方案1】:

    试试$parameters->hour=date("H:i:s",strtotime($request->hour));

    或者如果你想要$parameters->hour=strtotime(date("H:i:s",strtotime($request->hour)));

    【讨论】:

      【解决方案2】:

      你必须试试这个:

      $hour = "10:00:00";
      $parameters->hour = strtotime(date("H:i:s",strtotime($hour)));
      

      或者你可以使用碳

      \Carbon\Carbon::parse($hour)->format("H:i:s");
      

      【讨论】:

        猜你喜欢
        • 2014-09-18
        • 2015-10-08
        • 2013-05-27
        相关资源
        最近更新 更多