我想使用 CakePHP Helpers 将链接转换为按钮。
随着$this->Html->link()我能够使用数组(),包括'action' => 'view' . $user['User']['id'],但我不知道如何使用时,包括该$this->Form->button()相反。
使用$this->Html->link():
$this->Html->link('Click me', array(
'controller' => 'users',
'action' => 'view' . $user['User']['id']));
Run Code Online (Sandbox Code Playgroud)
我的解决方案不允许我添加 'action' => 'view' . $user['User']['id']
使用$this->Form->button():
echo $this->Form->button('Click me', array(
'type' => 'button',
'onclick' => 'location.href=\'/rentmyride/users/index/\';',
));
Run Code Online (Sandbox Code Playgroud)
使用<input>标签:
<input type="button" class="btn btn-primary" value="Click me"
onclick="location.href='http://www.domain.com';">
Run Code Online (Sandbox Code Playgroud)
使用<button>标签:
<button class="btn btn-success" onclick="location.href='http://www.domain.com';">
Click me
</button>
Run Code Online (Sandbox Code Playgroud) 我想使用polyfill,fetch()以便我的代码使用GitHub Fetch Polyfill在Safari 上运行,但我不确定如何使用它.
根据其文档,我可以安装它:
$ npm install whatwg-fetch --save
Run Code Online (Sandbox Code Playgroud)
我已经完成了这一步.
我已经尝试过这个,但它不起作用:
var fetch = require('whatwg-fetch') // does not work
Run Code Online (Sandbox Code Playgroud)
我怎么想使用fetch polyfill?
参考文献: