V
V
Vladislav Olegovich2019-05-01 18:28:10
PHP
Vladislav Olegovich, 2019-05-01 18:28:10

Why doesn't it see RedBeanPHP classes?

I'm trying to use the methods of the R class in my class, but PHP knows nothing about this class and gives the following error:
Fatal error: Uncaught Error: Class 'Accounts\R' not found in E:\servak\OSPanel\domains\diplo.me\ public\accounts.php:11
Here is the piece of code where I am trying to use RedBean

namespace Accounts;
   require 'E:\servak\OSPanel\domains\diplo.me\include.php'; //тут подключён файл с RedBeanPHP
   include_once '../helper.php';
   use RedBeanPHP; //пространство имён даже попытался указать
   class Account
   {
      public static function getEmployee()
      {
         $employee = R::FindOne('employees', 'WHERE user_id = ?', array($_SESSION['user_id']));
         b_dump($employee);
         return $employee;
      }

5cc9ba86a679f450654766.png
For some reason, it is assigned to my namespace, as the editor shows me.
How to connect RedBeanPHP normally?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2019-05-01
@BorisKorobkov

use RedBeanPHP; //namespace even tried to specify

In use, you must specify not just a namespace, but together with a specific R class. And, of course, do not forget to correctly configure autoload.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question