PHP: fonksiyon hatası Redeclare?

2 Cevap
<?php  
function date($x) {
    $contents = $_FILES['userfile']['tmp_name'];
    $contents = file("$contents");
    $date = $contents[$x][6].$contents[$x][7]
        ."-".$contents[$x][8].$contents[$x][9]
        ."-"."20".$contents[$x][4].$contents[$x][5];
    return $date;
}
?>

Ölümcül hata: hat 20 üzerinde tarih Redeclare () in ... / includes.php

Ben yukarıda biri olarak aynı kesin yapısı ile çeşitli işlevleri yarattık ve iyi çalışıyor. Nedense bu işlev bu hatayı iade ediyor. Bu sorunun Herhangi bir öneri / çözümler büyük takdir!

thx,

2 Cevap

PHP zaten bir date() işlevi vardır ve bu dilde mevcut fonksiyonları üzerine yazamaz. Lütfen fonksiyonu yeniden adlandırmak ve bu iş olacak. Ya da bir sınıf sarın ve de çalışacaktır.

Ölümcül hata: x.php Redeclare (daha önce ilan ...)

if (!function_exists('gule')) {
    function gule() {...}
}

I googled this because I could not redeclare function, as the .php file was included multiple times. Though unrelated, somebody might get here looking for this answer because of topic. :]