어떻게 코드를 써야만 쓸수록 수월해질수 있습니까?
<?php
include_once("mysqlConnect.php");//
include_once("api_config.php");//
session_start();
if(isset($_POST["invitees"])){
$invitees = $_POST["invitees"];
$leaderId = $_SESSION["userInfo"]["uId"];
$uTelephone = $_SESSION["userInfo"]["telephone"];
if($uTelephone == $invitees){
echo '(function(){alert("'.$config_6.'");document.getElementById("telephone").value="";document.getElementById("telephone").focus()})();';
exit;
}
$isInvited = $n->getlist("select * from invite where leaderId = {$leaderId} and memberPhone = '{$invitees}' and state = 0");
if(!count($isInvited)){
if(!$db->query("insert into invite (leaderId,memberPhone) values ($leaderId,'{$invitees}')")){echo '(function(){alert("error")})()';}
echo '(function(){rexseeSMSSender.send("sendSms","'.$invitees.'","'.$config_4.'");})()';
}else{
echo '(function(){alert("'.$config_5.'");window.location.href = "user.php";})();';
}
}
?>
항상 이런 코드에 문제가 있다고 생각한다. 안전성, 효율성, 유지보수성이 모두 나무랄 것 같다.LZ는 자신이 있는 사람이 아니다. 다른 사람이 기준을 정하고 그 기준에 따라 하면 스트레스가 적다고 생각하지만 자신이 기준을 정하면 그 기준이 다른 사람에게 받아들여지는지 의심(전형적인 학대받는 경향)이 많다.위의 코드처럼 자신이 썼지만 의심스러운 태도가 항상 존재하고 근거가 없거나 들은 소문에 대한 의심이 있다.
그리고 밑에 엉망진창인 코드처럼 쓰기에는 편하지만 다시 보면 이 코드가 자기가 쓴 것인지 의심스럽고,
$bangdan =<<<End
<div class="second" id="frozen" style="display:none">
<div class="cont" style="padding:0px;">
<div style="border-bottom:1px solid #e2e2e2; padding:0.7em 0.5em 0.2em 0.5em;">
<span style="font-size:1em;color:#2d9fc9"> </span><span style="font-size:0.8em;color:#999">( {$thisOrderTime})</span>
</div>
<div style="padding:0px;">
<div class="chart">
End;
$totalAssRank = $n->getlist("select * from fb_user where lastFrozen > 0 order by lastFrozen desc,user_id limit 20");
foreach($totalAssRank as $k=>$v){
t_checkCapital($v["user_id"],$v["receipt_earnings"],$v["esn"],$v["unreceipt_earnings"],$v["earnings_time"]);
$userId =$v["user_id"];
$userName = $v["user_name"];
$usercapital = $v["lastFrozen"];
$head = getUpPhoto($v["up_id"]);#
$newCapitalInfo = "<img src='img/more-dark.png' alt='' style='width:24px;height:24px;border:0px;'/>";#
t_checkCapital($v["user_id"],$v["receipt_earnings"],$v["esn"],$v["unreceipt_earnings"],$v["earnings_time"]);
$isNewPriInfo = $v["receipt_earnings"];
if($isNewPriInfo){$newCapitalInfo = "<span> </span>";}
$bangdan.=<<<End
<div onclick="javascript:rexseeBrowser.go('p_user.php?stealer={$userId}')" style="padding:0.5em 0.5em 0.3em 0.5em;" name="newCapitalInfo">
<table width="100%">
<tr>
<td><img src="{$head}" alt="" style="height:32px;width:32px;" onerror="javascript:this.src='img/head.png'"/></td>
<td style="width:6.5em"><div style="width:5em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" >{$userName}</div></td>
<td style="font-size:0.8em;width:5em;">{$usercapital}</td>
<td style="font-size:0.8em; color:#2d9fc9;padding-right:0.5em;" align="right" name="stealer{$userId}"><img src='img/more-dark.png' alt='' style='width:24px;height:24px;border:0px;'/></td>
</tr>
</table>
</div>
End;
}
$bangdan.=<<<End
</div>
</div>
</div>
</div>
End;
나는 코드를 어떻게 쓰는지, 실현해야 할 기능에 고민했다. 이 코드는 이미 실현되었다. 만약에 사용자의 측면에서 볼 때 그는 내가 쓴 원본 코드를 보지 않을 것이다. 그러나 이런 코드는 자신을 점점 피곤하게 하고 조금도 진보하지 않고 단지 코드를 쓸 뿐이라고 생각한다.이렇게 자신에게 초래된 결과는 코드를 쓸수록 피곤해지는 것이라고 생각한다.
여러분께 가르침을 청하고 싶은 것은:
1. 어떻게 하면 안전하고 효율적이며 복용성이 높아서 쓸수록 가볍고 즐겁게 쓸 수 있는 코드를 쓸 수 있습니까?
2. 사용자나 디자이너가 수요, UI를 변경하는 과정에서 폐기된 코드의 작성을 최대한 줄일 수 있는 방법을 미리 계획할 수 있다.
3. 점점 더 많은 신기술에 대해 어떤 마음으로 공부해야 하는가.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.