欢迎光临
感谢一路有你

heredoc技术

如果你对该文章中的内容有疑问/不解,可以点击此处链接提问
要注明问题和此文章链接地址 点击此处跳转
 

1,以<<<End开始标记开始,以End结束标记结束,结束标记必须顶头写,不能有缩进和空格,且在结束标记末尾要有分号 。开始标记和开始标记相同,比如常用大写的EOT、EOD、EOF来表示,但是不只限于那几个,只要保证开始标记和结束标记不在正文中出现即可。

2,位于开始标记和结束标记之间的变量可以被正常解析,但是函数则不可以。在heredoc中,变量不需要用连接符.或,来拼接。

 

<<<Kindeditor

Kindeditor;

function uploadFile($button = 'button', $return = 'file', $type = 'file') {
    $appRoot = __APP__;
    $htmlBox = <<<Kindeditor
<script language="javascript">
KindEditor.ready(function(K) {
var uploadFile = K.editor({
allowFileManager : true,
fileManagerJson : '{$appRoot}/public/manager',
uploadJson : '{$appRoot}/public/upload',
fileType : '{$type}',
//urlType : 'relative'
});
K('#{$button}').click(function() {
uploadFile.loadPlugin('insertfile', function() {
uploadFile.plugin.fileDialog({
fileUrl : K('#{$return}').val(),
clickFn : function(url, title) {
K('#{$return}').val(url);
uploadFile.hideDialog();
}});});});});
</script>
Kindeditor;
    return $htmlBox;
}

 

赞(0) 打赏
未经允许不得转载:王明昌博客 » heredoc技术
分享到: 更多 (0)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏