我正在努力Yii2.我有一个URL关于浏览器被重定向到我的重定向URI.
网址
https://accounts.zoho.com/oauth/v2/auth?scope=ZohoBugTracker.projects.ALL,ZohoBugTracker.bugs.ALL&client_id=1000&response_type=code&access_type=offline&redirect_uri=http://11.111.111.111:7000/api/oauth/zoho_auth
Run Code Online (Sandbox Code Playgroud)
当我点击上面的URL时,它会在提供代码时重定向到我的重定向URI
重定向URI
点击上面的URL后,重定向URI就是 http://11.111.111.111:7000/api/oauth/zoho_auth?code=1000&location=us&accounts-server=https%3A%2F%2Faccounts.zoho.com
重定向URI响应
{"Message":"找不到与请求URI匹配的HTTP资源" http://11.111.111.111:7000/api/oauth/zoho_auth?code=1000&location=us&accounts-server=https:%2F%2Faccounts.zoho. com '."}
如何code从上面的回应得到?
更新1
根据给出的建议.我试图GET使用linslin发送请求.以下是我的代码
public static function authToken()
{
$curl = new curl\Curl();
$response = $curl->setGetParams([
'scope' => 'ZohoBugTracker.projects.ALL,ZohoBugTracker.bugs.ALL',
'client_id' => '1000',
'response_type' => 'code',
'access_type' => 'offline',
'redirect_uri' => 'http://11.111.111.111:7000/api/oauth/zoho_auth',
])
->get('https://accounts.zoho.com/oauth/v2/auth');
echo $response;
exit();
}
Run Code Online (Sandbox Code Playgroud)
然后在函数中调用此函数,通过该函数我实际上使用zoho API创建错误
测试我的API通道POSTMAN
我的email …
我正在努力yii2.我sims在我的数据库中调用了一个主表,所有记录都在其中保存和更新.在我的GUI中,这些记录保存在SIM List.现在,有一个用例,我将sims发给一个人.发行方式有两种
两种情况都运行得很好.现在,通过excel文件发出sims,我想检查imsi号码是否在主记录中可用.
贝娄是我的Import掌控者
public function actionImport(){
$file_name = $_POST['file_name'];
$header_index = $_POST['header_index'];
$fieldSet = $_POST['field'];
$data = \moonland\phpexcel\Excel::widget([
'mode' => 'import',
'fileName' => 'uploads/' . $file_name,
'setFirstRecordAsKeys' => false, // if you want to set the keys of record column with first record, if it not set, the header with use the alphabet column on excel.
'setIndexSheetByName' => false, // set this if your excel data with …Run Code Online (Sandbox Code Playgroud) 我正在努力Yii2。我有一个gridviewwith复选框,并单击一个按钮,然后使用ajax将其重定向到动作控制器。
<?= Html::a('Disconnect', ['dco'], ['class' => 'btn btn-success', 'id'=>'dco']) ?>
<?php Pjax::begin(); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\CheckboxColumn', 'checkboxOptions' => function($d) {
return ['value' => $d['msn']];
}],
'ref_no',
'dept_code:ntext',
'dept_name:ntext',
'allowed_units',
'msn',
'units_consumed',
[
'label' => 'Disconnected',
'attribute' => 'disconnected',
'format'=>'raw',
'contentOptions' => ['style'=>'text-align:center'],
'value' => function($model){
return $model->disconnected == 1 ? '<span class="glyphicon glyphicon-ok text-success"></span>' : '<span class="glyphicon glyphicon-remove text-danger"></span>';
},
'filter' => Html::activeDropDownList($searchModel, 'disconnected', [''=>'All','1'=>'Yes','0'=>'No'], …Run Code Online (Sandbox Code Playgroud) 我正在努力yii2.在我看来,我正在尝试上传图片.但是我无法上传它.
模型
class MeterAcceptanceHeader extends \yii\db\ActiveRecord
{
public static $status_titles =[
0 => 'Prepared',
1 => 'Created',
2 => 'Printed',
3 => 'Canceled',
];
/**
* @inheritdoc
*/
public static function tableName()
{
return 'meter_acceptance_header';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['sub_div', 'prepared_by'], 'required'],
[['prepared_by', 'updated_by'], 'integer'],
[['prepared_at', 'updated_at'], 'safe'],
[['sub_div', 'meter_type', 'status'], 'string', 'max' => 100],
[['images'], 'string', 'max' => 255],
[['images'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png,jpg,pdf', 'maxFiles' => 4], …Run Code Online (Sandbox Code Playgroud) 我开发了一个带有web api两个参数的日期时间(开始和结束),然后应该给出不同的记录.
public HttpResponseMessage GetMeterPing(DateTime start, DateTime end)
{
try
{
var startDateTime = start;
var endDateTime = end;
var result = medEntitites.tj_xhqd.Where(m => m.sjsj >= startDateTime && m.sjsj <= endDateTime)
.OrderByDescending(o => o.sjsj)
.Select(s => new { s.zdjh, s.sjsj, s.xhqd })
.Distinct()
.FirstOrDefault();
return Request.CreateResponse(HttpStatusCode.OK, new { data = result });
}
catch (Exception ex)
{
return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
}
}
Run Code Online (Sandbox Code Playgroud)
API网址: http://localhost:14909/api/meters/GetMeterPing/2018-04-28T00:00:00/2018-04-27T23:59:59
当我运行web-api它时,它给了我
{ "数据":空}
同时在调试时result也是如此null
任何帮助将受到高度赞赏