【发布时间】:2014-09-24 22:02:15
【问题描述】:
我正在使用 xampp 开发我的应用程序,在那里一切正常。但是,当我将其上传到主机(托管商)并尝试访问特定页面时,我会收到 404 错误。
将我链接到该页面的按钮(来自不同的控制器)有一个 url:
array('url'=>'Yii::app()->createUrl("symptomHistory/patientSymptomHistory",array("id"=>$data->primaryKey))',
(它是网格视图中的一个按钮)
它调用的动作如下:
public function actionPatientSymptomHistory($id)
{
//create model doctor request and search the database for a doctor request between the doctor user and
//the patient user
$doctorRequestModel = new DoctorRequests;
$doctorPatientRequest = $doctorRequestModel->findByAttributes(array('doctorID'=>Yii::app()->user->id, 'userID'=>$id, 'doctorAccepted'=>1));
//if there is an accepted doctor request between doctor and patient, show the patients's symptom history
if(isset($doctorPatientRequest))
{
$model = new Symptomhistory;
//model for the patients data
$patientModel = User::model()->findByPk($id);
//empty array to store all the user's symptoms
$symptomItems = array();
//find all symptomHistory records belonging to the user
$symptomHistoryModels = $model->findAllByAttributes(array('user_id'=>$id));
//loop through all the symptomHistory records that belong to the user
foreach($symptomHistoryModels as $symptom)
{
//switch case for event color. set color for each flag type
switch($symptom->symptomFlag)
{
case '1':
$symptomColor = '#A1EB86';
break;
case '2':
$symptomColor = '#CCCA52';
break;
case '3':
$symptomColor = '#F25138';
break;
default:
$symptomColor = '#36c';
}
//create event
$symptomItem=array('title'=>$symptom->symptomTitle,
'start'=>$symptom->dateSymptomFirstSeen,
'end'=>$symptom->dateSearched,
'symptomCode'=>$symptom->symptomCode,
'symptomHistoryID'=>$symptom->id,
'flag'=>$symptom->symptomFlag,
'color'=>$symptomColor
);
//copy symptomHistory event into array
array_push($symptomItems, $symptomItem);
}
//render patient history
$this->render('patientSymptomHistory',array(
'model'=> $model, 'patientModel'=> $patientModel, 'symptomHistoryEvents'=>$symptomItems
));
}
else //else throw exception
{
throw new CHttpException(403, 'You are not permitted to check this patient\'s Symptom History');
}
}
(对不起,代码太长了,但老实说,我不知道什么可能有帮助,什么可能没有)。
我再说一遍,我收到的是 404 错误,而不是 403 错误。
有人知道我为什么会收到此错误吗?谢谢你的帮助:)
【问题讨论】:
-
控制器名称是什么?可能是您的控制器的名称,这就是问题所在。看看这个:stackoverflow.com/questions/25916671/…
-
哇哦,就是这样。现在发表你的评论作为答案,这样我就可以给你一些代表你可爱的人:)