我试图实现这样的事情:
<div>
<input type="checkbox" name="checkbox" id="checkbox_id" />
<label for="checkbox_id">I agree to the <a href="/tos">Terms of Service</a></label>
</div>
Run Code Online (Sandbox Code Playgroud)
我最接近实现这一点是通过:
<div>
{{ form_widget(form.agreeWithTos) }}
<label for="{{ form.agreeWithTos.vars.id }}">I agree to the <a href="#">Terms of Service</a></label>
</div>
Run Code Online (Sandbox Code Playgroud)
有没有更好的办法?必须指定{{form.agreeWithTos.vars.id}}是不优雅的.:)
我正在尝试编写一些代码来跟踪依赖项.有没有办法以编程方式检测是否已安装PEAR包?我想的是:
if ($some_pear_api->isPackageInstalled('FooPack')) {
echo 'FooPack is installed!';
} else {
echo 'FooPack is not installed. :(';
}
Run Code Online (Sandbox Code Playgroud)
我知道你可以简单地检测该包的类文件是否存在,但我主要想知道PEAR是否已安装,因为有时一些库提供了包含其代码的其他方法(例如PHPUnit有一个梨通道以及一个git repo ).
谢谢您的帮助!