如何显示用户消息

时间:2010-08-08 07:17:37

标签: php

任何显示用户消息的建议,以避免大量if / else语句。

if($row->num_rows > 1) {
  ok
 } else { 
print "There is no...";
}

谢谢!

1 个答案:

答案 0 :(得分:1)

$err = array();
if(!$row->num_rows > 1) {
 $err[]= "There is no...";
}
...
if (!$err) {
  //ok. doing stuff
} else {
  foreach ($err as $message) {
    echo $message."<br>\n";
  }
}