Note: This variable doesn't seem to get populated if you're running Xdebug.
$php_errormsg
$php_errormsg — Önceki hata iletisi
Açıklama
$php_errormsg PHP tarafından üretilen son hata iletisinin metnini içeren bir değişkendir. Bu değişken sadece hatanın oluştuğu alan içinde ve sadece track_errors ayar seçeneği açıldıysa (öntanımlı değeri kapalıdır) geçerlidir.
Bilginize: Bu değişken sadece php.ini içindeki track_errors yönergesi etkin olduğunda kullanılabilir.
Uyarı
Eğer bir kullanıcı tanımlı hata eylemcisi
( set_error_handler()) atanmışsa
$php_errormsg değişkenine sadece hata eylemcisi FALSE
döndürürse bir değer atanır.
Örnekler
Örnek 1 - $php_errormsg örneği
<?php
@strpos();
echo $php_errormsg;
?>
Yukarıdaki örnek şuna benzer bir çıktı üretir:
Wrong parameter count for strpos()
quickshiftin at gmail dot com ¶
4 months ago
While $php_errormsg is a global, it is not a superglobal.
You'll have to qualify it with a global keyword inside a function.
<?php
function checkErrormsg()
{
global $php_errormsg;
@strpos();
return $php_errormsg;
}
?>
josh at karmabunny dot com dot au ¶
1 year ago
The track_errors parameter is PHP_INI_ALL, so you can use code like this:
<?php
ini_set('track_errors', 1);
$result = @do_risky_thing();
if (! $result) {
echo '<p>Error' . htmlspecialchars($php_errormsg) . '</p>';
}
ini_set('track_errors', 0);
?>
