问一下关于扩展的使用

手册是这样:

public function actions()

{


	return array(


		'xyz'=>array(


			'class'=>'application.extensions.xyz.XyzClass',


			'property1'=>'value1',


			'property2'=>'value2',


		),


		// other actions


	);


}

}

=======================================

'property1'=>'value1',

'property2'=>'value2',

这两个属性是怎么样使用的呢?

是函数的参数么?还是Class的初始化参数值?

谢谢;-)

propertyX是指这个action class的属性。只要是可写属性,都可以这样初始化。

Quote

propertyX是指这个action class的属性。只要是可写属性,都可以这样初始化。

谢谢Qiang的解答,但是还是有点不解,我是这样写的

  public function actions()

  {

  return array (

    'test' => array (

      'class' => 'application.extensions.test.Test',

      'property1' => 'value1',

      )

    );

  }

===============================

class是这样写的:

<?php

class Test {

  public $property1;

  public $property2;

public function run()

{

// $this->property2 = "ccc";

}

  public function test()

  {

    echo $this->property1;

  }

}

?>

请问这样不对么? 谢谢;-)

你的test()名字和类名一样,被PHP当成constructor了。actions()里指定的属性初始值是在对象构造好后进行设置的。