Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何处理 Active Record 输出中的变量 Variable($$)?
对于前。
$qdata = $qmodel->findByAttributes(array("q_id"=>$testqs[0]->q_id)); $qcorrect = "answer".$qdata->correct_answer;
我需要$qdata->answer1。但是值 1 根据传递的内容是动态的。
$qdata->answer1
$qdata->$$qcorrect不起作用。
$qdata->$$qcorrect
只尝试一个 $ 符号:
$qdata->$qcorrect