我在一些脚本中找到了这个功能,但无法得到它的用途:
class DemoController extends Controller {
public function indexAction() {
$content = include('../index.php');
return array ('content' => $content);
}
}
Run Code Online (Sandbox Code Playgroud)
将php脚本包含到变量中有什么用?这是一种设计模式吗?谁能开车到正确的方向?
谢谢!
标记:
<ul>
<li role="presentation" class="active">
<a href="#1" aria-controls="1" role="tab">How to Install for iPad</a>
</li>
<li role="presentation">
<a href="#2" aria-controls="2" role="tab">How to Install for Mac</a>
</li>
<li role="presentation">
<a href="#3" aria-controls="3" role="tab">How to Install for PC</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
当我使用document.querySelectorAll('[role ="presentation"]'); 结果是数组 [li.active,li,li]
我如何删除.active类并使用普通JS w/o JQuery将其附加到这些li中的任何其他类更简单的方法?