Heim >Backend-Entwicklung >PHP-Tutorial >PHP代码优化有关问题
PHP代码优化问题
a.php
$title='3月5号开始会';
$classid='1';
$a='a';
$b='b';
$c='c';
$d='d';
?>
b.php
if (file_exists('a.php')) {
include('a.php');
$filesname= '文本文件.txt';
$txt = file($filesname);
foreach($txt as $row) {
$text = $text.$row.'
';}
$footer=file_get_contents('footer.html');
switch ( $classid )
{
case '1' :
$classname = '东区';
break;
case '2' :
$classname = '南区';
break;
case '3' :
$classname = '西区';
break;
case '4' :
$classname = '北区';
break;
default:
$classname = '其他';
};
}else {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: /error.html" );
};
?>