在PHP我们有CRON工作,托管服务器根据给定的时间表自动选择并执行任务.
什么是用于CRON工作的好方法ASP.NET?我想使用Web服务,但这在共享托管环境中不起作用.任何帮助将不胜感激,请在共享托管环境中建议一种方法.
我正在创建一个单元测试,并希望测试JSON响应中返回的结构.我知道它TestResponse提供了一种assertJsonStructure匹配JSON响应结构的方法.但由于某种原因,我无法将其映射$structure到我的响应,结果测试失败.让我分享一下所需的片段.
终点响应
{
"status": true,
"message": "",
"data": [
{
"id": 2,
"name": "Shanelle Goodwin",
"email": "chaz43@example.net",
"created_at": "2017-03-05 16:12:49",
"updated_at": "2017-03-05 16:12:49",
"user_id": 1
}
]
}
Run Code Online (Sandbox Code Playgroud)
测试功能
public function testEndpoint(){
$response = $this->get('/api/manufacturer/read', [], $this->headers);
$response->assertStatus(200);
$response->assertJsonStructure([
'status',
'message',
'data' => [
{
'id',
'name',
'email',
'created_at',
'updated_at',
'user_id'
}
]
]);
var_dump("'/api/manufacturer/read' => Test Endpoint");
}
Run Code Online (Sandbox Code Playgroud)
data数组中可以有多个节点,这就是为什么我试图在结构中提到数组,但似乎它没有正确映射.任何帮助将不胜感激:-)
当发生任何更改或编辑文档时,上述命名空间中是否有任何事件要触发,例如,发生文本输入
我试过
Microsoft.Office.Interop.Word.ApplicationEvents4_WindowSelectionChangeEventHandler
&
Microsoft.Office.Interop.Word.ApplicationEvents4_EPostageInsertEventHandler
但是每当我在活动的 Word 文档中插入文本时,我都无法触发事件。
我有一个 Web 应用程序,我根据标头中发送的自定义令牌进行身份验证API_TOKEN。在我在源代码(laravel)中进行了所有代码挖掘之后,我不确定发生了什么
这是我的中间件
protected $AUTH_HEADER = 'API_TOKEN';
protected $_RESPONSE = array('status' => false, 'message' => '', 'data' => array());
public function handle($request, Closure $next, $guard = null)
{
$response = $this->_RESPONSE;
if($request->hasHeader($this->AUTH_HEADER)){
$api_token = $request->header($this->AUTH_HEADER);
try{
$request->user = \App\User::where(['api_token' => $api_token])->firstOrFail();
Auth::login($request->user);
$response = $next($request);
}catch(\Exception $exception){
$response['status'] = false;
$response['message'] = 'Invalid Token.';
}
}else{
$response['status'] = false;
$response['message'] = 'Unauthorized Request.';
}
// Lines ONLY I used for cross verification of availability of my header …Run Code Online (Sandbox Code Playgroud) 我的Simple Angular JS应用程序无效.任何人都可以帮助我,以下是代码.Index.js是包含脚本文件的主文件controller.js.
当我尝试运行应用程序时,浏览器不显示任何错误:
var app = angular.module('myApp',[]);
app.controller('myCtrl',function($scope){
$scope.name="Angad";
});Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="utf-8" />
<title>Welcome</title>
</head>
<body ng-controller="myCtrl">
<nav>Navigation</nav>
<div ng-controller="myCtrl">
<input type="text" ng-model="name">
<h1>{{name}}</h1>
</div>
<footer>Copyright-2017</footer>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
我使用laravel添加数据的控制器代码如下所示.$request是全球声明的
public function createEnquiry(Request $request){
//my table is enquirydetails
DB::table('enquirydetails')->insert(
['name' =>$request->input('name'),
'address' =>$request->input('address') ,
'phone' =>$request->input('phone') ,
'created_at' => date("Y-m-d H:i:s") ,
'updated_at' => date("Y-m-d H:i:s"),
]);
}
Run Code Online (Sandbox Code Playgroud)
我需要在添加到db之后返回id.此代码是Lumen api数据库插入代码.Web路径是
$router->group(['prefix' => 'Enquiry','namespace' => 'Enquiry'],
function($router){
$router->post('new','EnquiryController@createEnquiry');
});
Run Code Online (Sandbox Code Playgroud) laravel ×3
c# ×2
laravel-5 ×2
laravel-5.4 ×2
angularjs ×1
asp.net ×1
c#-4.0 ×1
cron ×1
http-headers ×1
javascript ×1
ms-word ×1
php ×1
phpunit ×1
unit-testing ×1