Hangi desen benim php kodunuzu yorum benimsemelidir?

0 Cevap

ben sadece şimdi kodlama biraz büyük oldu ve ve ben kullanıyorum comments i / / ile yorumladı kodun her tek bir satır olarak, Çirkin ve Etkisiz arıyor benim PHP uygulama Kodlama bitmiş, bu benim ilk kodlama ve i tamamen habersiz değilim benim yorum bana ya herkes ileride daha güzel ve temiz görünmesi için benimsemeye metodolojinin. Birisi bana örnek model önermek eğer ben takdir ediyorum ..

Burada i kullanılan çirkin yorumlarla yazdı fonksiyonudur. Hangi desen Eğer kod yorumlama için kullanmak istiyorsunuz?

//function to check if the uploaded Image is valid
    function valid_image($image, $target, $url, $width, $height = 0) {
            //Check if the uploaded image is of type jpeg
            //if not then pop up a warning message and return false and redirect back
        if( $image["type"] !== "image/jpeg") {
            alert('File must be of type image/jpeg'); 
            redirect_url($url);           
            return false;
            }
            //Check the file Dimension of the Uploaded Image if it matches with the defined Value
             //Get the Dimensions of the image
            list($image_width, $image_height) = getimagesize($image['tmp_name']);
            //If the Parameter Height is empty then just check the image width and ignore the height rule
            //Print the appropriate message and return false and redirect back
        if( $height == '0') {
        if( $image_width !== $width) {
            alert("Incorrect File Dimension for  " . $image['name'] . " Please make sure it is $width in width");
            redirect_url($url);
            return false;
            }
            }
            //If the function has got all the parameter then check both the defined height and width 
            //Print the appropriate message and return false and redirect back
    else if($image_width !== $width || $image_height !== $height) {
            alert("Incorrect File Dimension for  " . $image['name'] . " Please make sure it is  $width X $height  ");
            redirect_url($url);
            return false;
            }
            return true;
            }

Şimdiden teşekkürler.

0 Cevap