0
누구든지 도움을받을 수 있습니다. 나는 더러운 코드를 최소화하고 싶다. 나는 논리가 약하다. 사전에 감사합니다 ..PHP 코드를 최소화하는 방법
//These are all fields
$prodname = $this->input->post('prodname');
$price = $this->input->post('price');
$qty = $this->input->post('qty');
$desc = $this->input->post('desc');
$status= $this->input->post('status');
// This part I want to minimize, or any shorthand for this code??
if ($prodname != NULL && $price != NULL && $qty != NULL && $desc != NULL && $status != NULL)
$datas = $this->controller->add_product($data);
가에 질문을 게시 http://codereview.stackexchange.com/ – sTg
이것이 양식에서 오는 경우. 그렇다면, codeigniters form_validation을 사용하면 폼 팩터에서 제공된 데이터가 사용자가 원하는 것임을 보장하기 위해 유효성 검사를 추가 할 수 있습니다. – TimBrownlaw