$url = isset($_GET["url"]) ? $this->checkValues($_GET["url"]) : $this->jDie();
$query = $this->query("SELECT * FROM `torrents` WHERE `url` = '".$url."'");
$fetch = $this->fetch($query) or $this->rURL('/#invalid-url');
版本 1:
<label><input type="checkbox" name="age" value="3" '.($this->contains("3", $fetch['age']) ? 'checked="checked"' : '').' class="age"/><span>3+</span></label>
<label><input type="checkbox" name="age" value="7" '.($this->contains("7", $fetch['age']) ? 'checked="checked"' : '').' class="age"/><span>7+</span></label>
<label><input type="checkbox" name="age" value="12" '.($this->contains("12", $fetch['age']) ? 'checked="checked"' : '').' class="age"/><span>12+</span></label>
版本 2:
$age = $fetch['age'];
[...]
<label><input type="checkbox" name="age" value="3" '.($this->contains("3", $age) ? 'checked="checked"' : '').' class="age"/><span>3+</span></label>
<label><input type="checkbox" name="age" value="7" '.($this->contains("7", $age) ? 'checked="checked"' : '').' class="age"/><span>7+</span></label>
<label><input type="checkbox" name="age" value="12" '.($this->contains("12", $age) ? 'checked="checked"' : '').' class="age"/><span>12+</span></label>
哪种方式更好?