正在播放:Laravel开发框架核心概念
更新时间:1年前
Laravel 核心概念
标 题 | 时 间 |
---|---|
Laravel开发框架核心概念 | 02:31 |
laravel 核心概念大串烧 | 05:39 |
Laravel Service Container 类的依赖管理和依赖注入 | 10:22 |
Service Container Binding - 如何绑定类和服务 | 07:55 |
Service Container 不使用依赖注入如何解析对象或服务 | 07:43 |
通过调试信息了解 Service Container $app 对象 | 03:32 |
Laravel Service Provider 初接触 | 05:44 |
用Service Provider 把自定义的服务注册到Service Container | 10:17 |
Service Provider 提升代码可维护性和扩展性 | 02:14 |
Facade 使用方法详解 | 11:24 |
Laravel Contracts 是怎么一回事儿 | 05:39 |
Laravel 生命周期无耻解说 | 01:04 |

小铭 2018-11-16 09:02:59
嗯,支持,我最近看项目源代码,一个网页中,右键某个节点,出现js遍历的菜单,菜单中自己加个按钮,调用Ajax或自定义的function,然后以json格式发送到后台C++接口

codinget 2018-11-16 09:15:47
网站把搜索功能加上了,以后找东西会方便很多

小铭 2018-11-16 09:29:58
good job~ 你如果不忙的话帮我解决个问题撒~ config/api.php就写了一句话,连接C++后台的一个URL:return ["base_url"=>"http://127.0.0.1:4567/home/proaim/RAM-int_c/WSGate",]; 路由定义:Route::any('/api/testApi', 'Api\ApiController@testApi'); /** * 自定义测试接口,想向接口发送个ID过去。 */ function testApi(Request $request) { $params = ['testApiParams' => $request->input("blockID")]; return $this->_api_mod->post("testApi", $params); } app/Model/Api.php中post的代码: function post($method,$params){ $curl = new Curl(); $curl->setTimeout(600); $json = ["method"=>$method,"params"=>$params,"id"=>1]; $curl->post($this->base_url,json_encode($json)); if ($curl->error) { return ["result"=>"","error"=>"接口调用失败", "id"=>1]; } else { $result = $curl->response; return json_decode(json_encode($result),true); } } public/assets/compManager/index.js,写的很复杂,看不太明白: 我按照他已经写好调用接口的代码,比葫芦画瓢,在下面加了句:'testApi': {label: '测试API接口', ajax: true, url: '/api/testApi'}, 然后贴上下面他调用的Ajax源码: //新建 for (var key in rightClickItems) { if (rightClickItems[key].url && key !== 'sedRootFMECA') { //sedRootFMECA为根节点,没有新建 $common_xlContent_custom.on('click', '.' + key, function () { var $this = $(this) var _item = rightClickItems[$this.data('operate')] if (_item.open) { if ($this.data('operate') === 'riskMatrix') { var _id = ztreeSedObj.getNodeByTId($this.data('tid')).id location.href = _item.url + '?blockid=' + _id } else { location.href = _item.url } } else if (_item.ajax) { // 自定义属性 data-tid="ztree_sed_1" 获取方式 当前标签.data('tid').id var _id = ztreeSedObj.getNodeByTId($this.data('tid')).id $.ajax({ url: _item.url, dataType: 'json', data: {blockID: _id, _token: _token}, type: "POST", success: function (data) { console.log(data); if (data.error == "0") { $.alert("操作成功") //他源码写好的调用后台的按钮,点一下,就会在这里弹出,我比葫芦画瓢,就提示 Wrong method QAQ咋办 } else { $.alert(data.error) } } }) } else { var _tId = $this.data('tid') if (_tId === 'ztree_main' || _tId === 'ztree_sed') { $iframeForm.prop('src', _item.url) } else { var _treeObj = $('#' + _tId).parents('.ztree')[0].id === 'ztree_main' ? ztreeMainObj : ztreeSedObj _treeObj.cancelSelectedNode() var pid = _treeObj.getNodeByTId(_tId).id $iframeForm.prop('src', _item.url + '?pid=' + pid) } } }) } }



暂无相关资源