'components' => [
'request' => [
'csrfParam' => '_csrf-api',
'parsers' => [
'application/json' => [
'class' => \yii\web\JsonParser::class,
'asArray' => true,
],
],
],
// ...{
"name": "Nick"
}$name = Yii::$app->request->post('name') будет работать. <input type="hidden" id="input-data-to-vue" value='<?= json_encode($data_from_php) ?>'>...
data() {
return {
dataFromPhp: null
}
}
...
created() {
this.dataFromPhp = JSON.parse(document.getElementById('input-data-to-vue'));
}
... $result = $wpdb->get_results( "SELECT COUNT(*) as cnt FROM `wp_posts` WHERE `post_status` LIKE 'publish' AND `post_type` LIKE 'task'" );$result[0]->cntпо идее