Answer the question
In order to leave comments, you need to log in
Why error while executing PHP script?
There are two files index.php and member.php
index.php
<?php
require_once 'app/member.php';
$user = new member();
echo $user->username;
<?php
namespace app;
class member
{
public $username = '';
private $login_status = false;
public function login()
{
$this->login_status = true;
}
public function logout()
{
$this->login_status = false;
}
public function islogin()
{
return $this->login_status;
}
}
Answer the question
In order to leave comments, you need to log in
Read php.net/manual/ru/language.namespaces.php for example.
Because member is in the namespace app and accordingly you need to write
PS Since we started using namespace, it is logical to start using autoload php.net/manual/ru/language.oop5.autoload.php , it's very convenient.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question