GüLe SeVDaLi BiR GeNçLiK
WEBMASTER SAHASI => Webmaster Kaynaşma Yeri => Script Bölümü => Konuyu başlatan: sevdaligul - 17 Şubat 2008, 14:39:27
-
İşe Yarayan Küçük PHP Kodları, birkaç işe yarar kod parçası için tıklayın..
İşe Yarayan Küçük PHP Kodları
Cookie Ayarlamak
setcookie("Cookie_name", "Cookie_value", time()+3600, "/", ".yourdomain.com"); // expires in 3600 seconds = 1 hour
Cookie Almak
echo $_COOKIE["Cookie_name"]; // echo the cookie value
Session Başlatmak
session_start();
$_SESSION['session_name'] = "This is a value set to session_name";
Session Almak
session_start();
echo $_SESSION['session_name'];
Tarih ve Saat Göstermek
echo date('l dS \of F Y h:i:s A'); // echos Monday 15th of August 2005 03:12:46 PM
Satır Satır Dosya Okumak
$af=file("a_text_file.txt");
foreach($af as $line)
{
echo "$line"; // shows all the content in the file $af line by line
}
Alıntı