A
A
arybak20172019-07-03 10:33:46
PHP
arybak2017, 2019-07-03 10:33:46

Using a function from another file doesn't work?

Hello, I'm using the Madeline Proto library. There is code from the first file:

include 'madeline.php';
$MP = new \danog\MadelineProto\API('session.madeline');
$MP->start();
...
case '/test':
            include 'MTProto.php';
            send($MP);
            break;
и код файла MTProto.php:
function send($MP)
    { 
        $MP->messages->sendMessage(['peer' => ' *****', 'message' => 'test in function']);  
    }

When I use the /test command, nothing is sent to me. What is the problem? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kafkiansky, 2019-07-03
@mad_maximus

The real problem is that it's time to switch to autoload. Shouldn't $MP->start() be called at the end?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question