我试图弄清楚为什么我的 php 错误日志给了我这个错误。PHP 警告:stristr():第 25 行 filename.php 中的空分隔符
现在我查看了这条线,没有一个变量是空的。因此,对此的任何帮助都会很棒,因为我找不到任何问题。它也确实有效,但只是发出警告。我想看看我能不能修复它。下面是整个代码。
<?php
if(!$db = @mysql_connect("$dbhost", "$dbuser", "$dbpass"))
die('<font size=+1>An Error Occurred</font><hr>Unable to connect to the database. <BR>Check $dbhost, $dbuser, and $dbpass in config.php.');
if(!@mysql_select_db("$dbname",$db))
die("<font size=+1>An Error Occurred</font><hr>Unable to find the database <b>$dbname</b> on your MySQL server.");
if (isset($dj)) {
$dj = NULL;
}
$query="SELECT * FROM currentdj";
$result=mysql_query($query);
while($row = mysql_fetch_array($result)) {
$did = $row['dj'];
$aliasa = $row['alias1'];
$aliasb = $row['alias2'];
$aliasc = $row['alias3'];
// The following code should detect DJ by song title, for Podcast and Audio Fictions
if ((isset($aliasa)) && (stristr($song[0], $aliasa) !== FALSE)) {
$setby = "Alias1";
$dj = $did;
}
if ((isset($aliasb)) && (stristr($song[0], $aliasb) !== FALSE)) {
$setby = "Alias1";
$dj = $did;
}
if ((isset($aliasc)) && (stristr($song[0], $aliasc) !== FALSE)) {
$setby = "Alias1";
$dj = $did;
}
// The following code should detect DJ by server title, for DJS and autodj
if ((isset($aliasa)) && (stristr($servertitle, $aliasa) !== FALSE)) {
$setby = "Alias1";
$dj = $did;
}
if ((isset($aliasb)) && (stristr($servertitle, $aliasb) !== FALSE)) {
$setby = "Alias2";
$dj = $did;
}
if ((isset($aliasc)) && (stristr($servertitle, $aliasc) !== FALSE)) {
$setby = "Alias3";
$dj = $did;
}
}
?>
因此,我的所有 If isset 语句都收到此警告。