doudou5421 2013-07-25 11:02
浏览 59

脚本客户端代码到php webservice

I am really sticky on this problem :

here is a php server side code , i wanna do a web service , the client is java script , i wrote it in php client and it worked ,, i tried many times to make client java script to call the web service from the php server according to the yii framework , can any body give me a java script code to handle this web service in the php code down (ther is just one service getSMS) , and if any body wanna the script code to check where the error is , i will send it to him:

 ** <?php
   ini_set ('soap.wsdl_cache_enabled',0);
class WebservicesController extends Controller
 {

  /**
  * @var string the default layout for the views.
 Defaults to '//layouts/column2',         meaning
  * using two-column layout. See 'protected/views/layouts/column2.php'.
  */


  /**
  * @return array action filters
    */









  /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
  public function accessRules()
  {
   return 
    array('allow', 
        'actions'=>array('quote'),
        'user'=>array('*'),);


   }



    public function actions()
  {
  return array(
      'quote'=>array(
          'class'=>'CWebServiceAction',
            'classMap'=>array(
      'Sms'=>'Sms',
      )
      ),
  );
    }




       /**
      //
         * @return string
      * @soap
      */

        public function getSMS()
       {

     $user = Yii::app()->db->createCommand()
     ->select('text')
     ->from('sms')
      ->queryall();


       return json_encode($user);






           }



    }

   class webservices extends CActiveRecord
  {
   /**
  * @var integer post ID
  * @soap
  */
 public $id;
 /**
* @var string post title
 * @soap
 */
  public $title;

  public static function model($className=__CLASS__)
  {
  return parent::model($className);
  }
   }




  ?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题
    • ¥15 finalshell节点的搭建代码和那个端口代码教程
    • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
    • ¥15 Centos / PETSc / PETGEM
    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 海浪数据 南海地区海况数据,波浪数据
    • ¥20 软件测试决策法疑问求解答