PHP code optimization question a. php & lt ;? Php $ title starts on October 11, March 5; $ class; $ aa; $ bb; $ cc; $ dd ;? & Gt; B. php & lt ;? Phpif(file_exists(a.php?####de(a.php?##filesname=file .txt; $ txtfil PHP code optimization
A. php
$ Title = 'October 22, March 5 ';
$ Classid = '1 ';
$ A = 'a ';
$ B = 'B ';
$ C = 'C ';
$ D = 'd ';
?>
B. php
If (file_exists ('A. php ')){
Include ('A. php ');
$ Filesname = 'Your file .txt ';
$ Txt = file ($ filesname );
Foreach ($ txt as $ row ){
$ Text = $ text. $ row .'
';}
When footer1_file_get_contents('footer.html ');
Switch ($ classid)
{
Case '1 ':
$ Classname = 'East ';
Break;
Case '2 ':
$ Classname = 'South ';
Break;
Case '3 ':
$ Classname = 'West ';
Break;
Case '4 ':
$ Classname = 'North region ';
Break;
Default:
$ Classname = 'Others ';
};
} Else {
Header ("HTTP/1.1 301 Moved Permanently ");
Header ("Location:/error.html ");
};
?>
<? Php echo $ title;?>
How can we optimize PHP code to make browsing faster?
A. is it better to use data in php?
------ Solution --------------------
There is no need to optimize these lines of code.
You cannot feel the effect after optimization.
------ Solution --------------------
In a file, it is optimal not to include nested content.
------ Solution --------------------
The most important thing to optimize this code is the format. the code that does not pay attention to indentation is the most ugly.