Answer the question
In order to leave comments, you need to log in
How to fix error on hosting?
When I worked on the local, such an error did not come out, when I uploaded it to the site, I got the error Illegal string offset 'message'. Although I did everything according to the documentation, and so I didn’t understand what the error was, should the array be there, or am I doing something wrong?
<?php
namespace frontend\components;
use app\models\User;
$token = 'token';
$webSite = 'https://api.telegram.org/bot'.$token;
$output = file_get_contents('php://input');
$message = $output['message'];
$id = $message['chat']['id'];
$model = User::findOne(\Yii::$app->user->id);
$model->telegram_chat_id = $id;
$model->save();
Answer the question
In order to leave comments, you need to log in
When I worked locally, I didn't get this error.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question