Home  >  Article  >  Backend Development  >  一看到这种程序就想抽写这种代码的人解决方案

一看到这种程序就想抽写这种代码的人解决方案

WBOY
WBOYOriginal
2016-06-13 10:46:27831browse

一看到这种程序就想抽写这种代码的人

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->if($server > 0){    if(empty($dblist))    {        $dbs = mysql_list_dbs();        $num_dbs = mysql_numrows($dbs);    }    else    {        $num_dbs = count($dblist);    }    for($i=0; $i      <div id="el<?php echo $j;?>Parent" class="parent">      <a class="item" href="db_details.php?server=<?php%20echo%20%24server;?>&db=<?php%20echo%20%24db;?>" onclick="expandIt('el<?php echo $j;?>'); return false;">      <img name="imEx" src="images/plus.gif" border="0" alt="+"    style="max-width:90%"  style="max-width:90%" id="el<?php echo $j;?>Img"></a>      <a class="item" href="db_details.php?server=<?php%20echo%20%24server;?>&db=<?php%20echo%20%24db;?>" onclick="expandIt('el<?php echo $j;?>');">      <font color="black" class="heada">    <?php echo $db;?>      </font></a>      </div>      <div id="el<?php echo $j;?>Child" class="child">    <?php $tables = mysql_list_tables($db);    $num_tables = @mysql_numrows($tables);    for($j=0; $j<$num_tables; $j++)    {        $table = mysql_tablename($tables, $j);        ?>            <nobr>    <a target="phpmain" href="sql.php?server=<?php%20echo%20%24server;?>&db=<?php%20echo%20%24db;?>&table=<?php%20echo%20urlencode(%24table);?>&sql_query=<?php%20echo%20urlencode(" select from>&pos=0&goto=tbl_properties.php"><img src="images/browse.gif" border="0" alt="<?php echo $strBrowse." :>"></a> <a class="item" target="phpmain" href="tbl_properties.php?server=<?php%20echo%20%24server;?>&db=<?php%20echo%20%24db;?>&table=<?php%20echo%20urlencode(%24table);?>"><?php echo $table;?></a></nobr><br>        <?php 


要是随便给他改几个地方,不知道他自己能不能改好。

------解决方案--------------------
麻花代码 看起来就不爽
------解决方案--------------------
改一次麻烦一次,就这点?重写
------解决方案--------------------
这样的代码看起来比较乱,后期维护比较麻烦
------解决方案--------------------
别抽我,我写过.而且一写还写了好些年
------解决方案--------------------
我一直都是html和php分开写的
------解决方案--------------------
探讨

我一直都是html和php分开写的

------解决方案--------------------
全都是php tag & echo
应该是早期代码了
在2005年左右,这种代码风格最流行了
------解决方案--------------------
这样写的乱,看不出层次结构
如果把HTML和后台写在一起的话,就全用后台输出
这样结构清楚,后台解释输出也快
------解决方案--------------------
编码规范很重要滴
------解决方案--------------------
咳咳,
虽然说的确这样的代码不算好....不过, 如果你看到这样的代码就要抽人的话, 那你可抽的人多了...我也难逃厄运啊....

随便挑几个有点历史的开源php软件都能看到这样的代码.....

在OO被引进php之前,在smarty等模板流行之前,php就是这样的...

而且,在那个时候,这是作为一个"进步", 相对于perl等老式web编程需要大段大段输出的方式
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
Previous article:怎样在PHP文件里修改PHP配置?该如何处理Next article:请教怎么抓取用JS分页的网页内容

Related articles

See more