欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

linux php下Ajax请求时URL路径出现重复

程序员文章站 2022-05-06 20:49:26
...
1. 项目用的YII框架,在module下面的Usertest.php有一个方法:

public function getTextArea($fieldName,$usertest_id) {    	      
        return CHtml::activeTextArea($this,$fieldName,array("name"=>$fieldName."_".$usertest_id,'style'=>'rows:3;cols:20;',"ajax" => array("type"=>"POST","url"=>"/usertest/ChangeComments", "data"=>array("usertest_id"=>$usertest_id,"usertest_comments"=>"js:this.value"),"success"=>"js:alert(\"Update comments success!\")")));     
    }
调用的地方在usertest/index.php里面,代码如下:

array(
        'name' => 'usertest_comments',
        'id' => 'usertest_comments',
        'header'=>'Comments',
       'type'=>'raw',
        'value'=>'$data->getTextArea(\'usertest_comments\',$data->usertest_id)',
        'htmlOptions'=>array('style'=>'width:100px;'),
       ),
linux php下Ajax请求时URL路径出现重复
开发在windows上,页面访问没有问题,访问路径是正确的: */usertest/ChangeComments