gpt4 book ai didi

php - bug fatal error : Cannot redeclare date_diff() in

转载 作者:行者123 更新时间:2023-12-02 11:22:16 24 4
gpt4 key购买 nike

我使用的 cakephp 版本为 1.1.7692。

当我使用 php ver > 5.3.2 运行它时,它有错误:

Fatal error: Cannot redeclare date_diff().

我用 php ver 5.2.9 运行它,它显示的文本和代码与以下内容相同:

quality = 100; $thumb->fileName = "/path/to/file.jpg"; //IMPORTANT -
must run init() function before any manipulation is performed
$thumb->init(); //shrink image by 50% $thumb->percent = 50;
$thumb->resize(); //crop image to 350x350 from center of image
$thumb->cropSize = 350; $thumb->crop(); //resize image to no more than
125px wide $thumb->percent = 0; $thumb->maxWidth = 125;
$thumb->resize(); //save image as 'filename.jpg'
$thumb->save('/path/to/save/filename.jpg'); You can also use this
class to dynamically generate thumbnails and display them After you
have made your manipulations you could display the result by: echo '';
*/ class ThumbnailComponent extends Object { var $errmsg; //error message to parse var $error; //flag for whether there is an error var
$format; //file format of image var $currentDimensions=array();
//current dimensions of working image var $newDimensions=array();
//new dimensions after manipulation var $newImage; //final image to
be displayed/saved var $oldImage; //original image to be manipulated
var $workingImage; //working image being manipulated var $fileName;
//filename of image, can include directory var $maxWidth; //maximum
width of the image var $maxHeight; //maximum height of the image var
$percent; //percentage of the original image size var $quality;
//image quality of jpeg images var $cropSize;....

这是函数 date_diff :

function date_diff($start_date,$end_date)
{
$splitstdate = split(" ",$start_date);
$splitenddate = split(" ",$end_date);

list($year,$month,$day)=split("-",$splitstdate[0]);
list($year_test,$month_test,$day_test)=split("-",$splitenddate[0]);


list($hour,$min,$sec)=split(":",$splitstdate[1]);
list($hour_test,$min_test,$sec_test)=split(":",$splitenddate[1]);

$start = mktime($hour, $min, $sec,$month,$day,$year);
$end = mktime($hour_test, $min_test,$sec_test,$month_test,$day_test,$year_test);
$date_diff = $start-$end;
if($date_diff<0)
$date_diff=0;
$days = intval($date_diff /(3600*24)) ;

$hms = date('h \h\r \m\i\n s \s\e\c \a\g\o',$date_diff);
return $days.' days '.$hms ;
}

谁能知道bug的原因和解决方法吗?谢谢大家。

最佳答案

date_diffphp 版本 5.3.0 中的内置函数,您无法重新声明它。

关于php - bug fatal error : Cannot redeclare date_diff() in,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15544980/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com