codecamp

YurunDoc 动态加载配置

ApiAgent不光是一个接口代理项目,也可以作为类库使用。 把ApiAgent当作类库使用时,不可避免的需要对ApiAgent做一些配置。配置文件如果放在vendor目录里的ApiAgent目录中肯定是不科学,这时候我们可以手动传递配置。

// 通用配置
$config = array();
// 跨域接口代理配置
$crossConfig = array();
// 接口合并配置
$batchConfig = array();
// 这里仅仅做个演示,实际开发时候一般使用框架内置的配置方法获取配置。


// 跨域接口代理
\Yurun\ApiAgent\ApiAgent::run('Cross', $config, $crossConfig);


// 接口合并
\Yurun\ApiAgent\ApiAgent::run('Batch', $config, $batchConfig);
YurunDoc 接口合并请求
YurunDoc 插件开发
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }