0
我的網址,以獲取標識是這樣的:/backend/web/product/1
在URL瓦特/漂亮的URL格式
我ProductController的:
namespace backend\controllers;
use Yii;
use backend\models\Product;
class ProductController extends \yii\rest\Controller
{
public $enableCsrfValidation = false;
public function actionIndex()
{
\Yii::$app->response->format = yii\web\Response::FORMAT_JSON;
$product = Product::find()->All();
return $product;
}
public function actionView($product_id)
{
// how can I get 1 in my URL? so i can use it inside this function
}