【问题标题】:need baseurl in config.js file在 config.js 文件中需要 baseurl
【发布时间】:2016-11-08 09:23:00
【问题描述】:

在我的 config.js 文件(粘贴在下面)中,我需要获取基本 url,但我使用的 php 基本 url 脚本不起作用。关于我可以用来替换下面的 php 基本 url 的任何建议?

BOBBIEEDITOR.editorConfig = function( config ) {
    config.fileopener = '<?php echo $this->baseUrl;?>files/browse.php?opener=bobbieeditor&type=files';
};

【问题讨论】:

  • 另存为PHP文件,并使用HTACCESS作为RewriteRule for config.js to config.php ?

标签: javascript php jquery config base-url


【解决方案1】:

你能把$this->baseUrl的值放上去吗?以元数据为例:

<!DOCTYPE html>
<html>
<head>
<meta name="data-base-url" content="<?php echo $this->baseUrl;?>" />

用 JS 搞定:

var base_url = document.querySelectorAll('head > meta[name="data-base-url"]');
var base_content = base_url[0].getAttribute('content');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    • 2012-03-16
    • 2013-11-30
    • 1970-01-01
    相关资源
    最近更新 更多