PHP mktime()需要参数

时间:2016-09-25 02:28:33

标签: php mktime

我不知道怎么解决这个问题,我试图搜索相同的问题,但我感到困惑甚至更多......请帮忙吗?提前谢谢!

错误:

PHP Warning:  mktime() expects parameter 1 to be long, string given in /home/web/public_html/sample.php on line 85

PHP脚本:

<?php
    $ArrDate=explode(' ',$datetime);
    $date=explode('/',$ArrDate[0]);
    $time=explode(':',$ArrDate[1]);
    // Check if new
    if(mktime($time[0],$time[1],$time[2],$date[1],$date[0],'20'.$date[2]) > $_COOKIE['newposts']) {
        $new='_new';
    }
?>

第85行:

if(mktime($time[0],$time[1],$time[2],$date[1],$date[0],'20'.$date[2]) > $_COOKIE['newposts'])

1 个答案:

答案 0 :(得分:1)

正如新手在评论中所提到的,使用intval()将参数转换为整数。

for(int i=0;i<nums.length;i++){ map.put(nums[i],i); } for(int i=0;i<nums.length;i++){ int complement = target - nums[i]; if(map.containsKey(complement) && map.get(complement) != i){ return new int[] { i, map.get(complement)}; } } throw new IllegalArgumentException("No two sum solution"); } public void main(String[] args){ int nums[] = {1,2,3,4}; System.out.println(twoSum(nums,5)); for(int i=0;i<4;i++){ System.out.println(i+"->"+"map="+map); } } }