duanjianfu1398 2015-12-24 05:17
浏览 134
已采纳

strtotime什么也没输出

I tried the following

echo "Pre order date > $pre_order_close_date";
$pre_order_unix_time = strtotime($pre_order_close_date);    
echo "Unix time is > $pre_order_unix_time";

The result is

Pre order date >  31 Jan 2016Unix time is >

I then tried the following to see if my date format is fine

echo "Pre order date > $pre_order_close_date";
$pre_order_unix_time = strtotime("31 Jan 2016");    
echo "Unix time is > $pre_order_unix_time";

The result return was

Pre order date >  31 Jan 2016Unix time is > 1454198400

It seems that if I input the string directly its working fine, but if I use a variable in place of 31 Jan 2016, it does not output anything.

What could I have do wrong here.

Thanks for helping!

** How I get my pre_order_close_date **

$get_content is of this value

<p>Retail Price: USD 42<br />
<span class="il">Pre</span>&#8211;<span class="il">Order</span> Price: USD 40<br />
<span class="il">Pre</span>&#8211;<span class="il">Order</span> <span class="il">Close</span> <span class="il">Date</span>: 31 Jan 2016<br />
Release <span class="il">Date</span>: 1Q 2016</p>
$get_content_explode = explode("
",$get_content);

foreach($get_content_explode as $gce)
{
if(strstr(strtolower($gce),"close"))
{
$pre_order_close_arr = explode(":",$gce);
$pre_order_close_date = trim($pre_order_close_arr[1]);
}//end if gce
}//end foreach
  • 写回答

1条回答 默认 最新

  • dongquepao8653 2015-12-24 05:50
    关注

    $get_content contains HTML markup. Use strip_tags() to remove it.

    $get_content_explode = explode("
    ", str_replace('&nbsp;', ' ', (strip_tags($get_content))));
    

    DEMO

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 求解vmware的网络模式问题 别拿AI回答
  • ¥24 EFS加密后,在同一台电脑解密出错,证书界面找不到对应指纹的证书,未备份证书,求在原电脑解密的方法,可行即采纳
  • ¥15 springboot 3.0 实现Security 6.x版本集成
  • ¥15 PHP-8.1 镜像无法用dockerfile里的CMD命令启动 只能进入容器启动,如何解决?(操作系统-ubuntu)
  • ¥30 请帮我解决一下下面六个代码
  • ¥15 关于资源监视工具的e-care有知道的嘛
  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?