PHP etiketleri

PHP bir dosyayı çözümlerken, hangi bölümü yorumlayıp hangi bölümü yorumlamadan geçeceğine karar vermek için <?php ve ?> açılış ve kapanış etiketlerine bakar. Bu şekilde çözümleme PHP'nin her çeşit farklı belgeye gömülmesini sağlar, çünkü bir çift açılış ve kapanış etiketinin dışındaki her şey PHP çözümleyicisi tarafından gözardı edilir.

PHP daha açıklayıcı olan <?php echo etiketine bir kısaltma olarak <?= kısa echo etiketini içerir.

Örnek 1 - PHP Açılış ve Kapanış Etiketleri

1. <?php echo 'XHTML veya XML belgelerde PHP kodu sunmak isterseniz,
bu etiketleri kullanın'
; ?>

2. Kısa echo etiketi kullanabilirsiniz: <?= 'print this string' ?>.
<?php echo 'print this string' ?> koduna eşdeğerdir.

3. <? echo 'bu kod kısa etiketler arasında olmakla birlikte sadece,'.
'short_open_tag etkinse çalışır.'; ?>

PHP ayrıca kısa başlangıç etiketine de <? izin verir. Bu sadece, PHP --enable-short-tags yapılandırma seçeneği ile derlenerek veya php.ini yapılandırma dosyası yönergesi short_open_tag kullanılarak etkinleştirilebilir.

Bilginize:

Kısa etiketler iptal edilebileceğinden uyumluluk adına sadece normal etiketlerin (<?php ?> ve <?= ?>) kullanılması önerilir.

Bir dosya sadece PHP kodu içeriyorsa, dosyanın sonunda PHP kapanış etiketini koymamak tercih edilir. Yazılımcıdan herhangi bir çıktı gönderme isteği gelmezse PHP betiğin bu noktasında çıktı tamponlamasını başlatacağından kapama etiketinden sonra istenmeyen etkilere neden olabilecek boşluk veya yeni satırların yanlışlıkla eklenmesi böylece engellenmiş olur.

<?php
echo "Merhaba Dünya";

// ... daha kod

echo "İletişimin sonu";

// PHP kapama etiketi olmadan betik burada biter

add a note

User Contributed Notes 2 notes

up
-1
Jake Paul
1 day ago
I made a severe and continuous lapse in my judgement, and I don’t expect to be forgiven. I’m simply here to apologize. What we came across that day in the woods was obviously unplanned. The reactions you saw on tape were raw; they were unfiltered. None of us knew how to react or how to feel. I should have never posted the video. I should have put the cameras down and stopped recording what we were going through. There's a lot of things I should have done differently but I didn't. And for that, from the bottom of my heart, I am sorry. I want to apologize to the internet. I want to apologize to anyone who has seen the video. I want to apologize to anyone who has been affected or touched by mental illness, or depression, or suicide. But most importantly I want to apologize to the victim and his family. For my fans who are defending my actions, please don't. I don’t deserve to be defended. The goal with my content is always to entertain; to push the boundaries, to be all-inclusive. In the world I live in, I share almost everything I do. The intent is never to be heartless, cruel, or malicious. Like I said I made a huge mistake. I don’t expect to be forgiven, I’m just here to apologize. I'm ashamed of myself. I’m disappointed in myself. And I promise to be better. I will be better. Thank you.
up
-48
Anonymous
3 months ago
A whitespace or newline character must follow '<?php' and precede '?>'.
To Top