Home  >  Article  >  Backend Development  >  PHP code should be safe, structured, standardized and adaptive_PHP tutorial

PHP code should be safe, structured, standardized and adaptive_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 14:57:53927browse

Good PHP code should be structured.
Excellent PHP code should be standardized.
Good PHP code should be adaptive.
Good PHP code should be safe.

What are the advantages and disadvantages of PHP code?

Copy to ClipboardLiehuo.Net CodesQuoted content: [www.bkjia.com] 1. Unoptimized php code
echo("

Search results for query: " .
$_GET['query'] . ".

" );
?>
2. Simple optimized code
echo("

Search results for query: " .
htmlspecialchars($_GET[' query']) . “.

”);
?>
3. Reasonably optimized code
if (isset($_GET['query ']))
{
echo '

Search results for query: ',
htmlspecialchars($_GET['query'], ENT_QUOTES), '.

';
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/363959.htmlTechArticleExcellent PHP code should be structured. Good PHP code should be standardized. Good PHP code should be adaptive. Good PHP code should be safe. Advantages of PHP code...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn