Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 以面向对象的方式从文本框中获取值_Php_Oop - Fatal编程技术网

Php 以面向对象的方式从文本框中获取值

Php 以面向对象的方式从文本框中获取值,php,oop,Php,Oop,这是我获取值的方法。一切都很好,但我想使用OOP获取值 比如Classname::methodname(文本框的名称)这样。我该怎么做 public function display() { $name=$_POST['name']; $b=$_POST['email']; $c=$_POST['pass']; $d=$_POST['rpass']; $e=$_POST['phone']; $t=new User(); $t->f

这是我获取值的方法。一切都很好,但我想使用OOP获取值

比如Classname::methodname(文本框的名称)这样。我该怎么做

public function display()
{
    $name=$_POST['name'];
    $b=$_POST['email'];
    $c=$_POST['pass'];
    $d=$_POST['rpass'];
    $e=$_POST['phone'];

    $t=new User();

    $t->findEmail($b);
    $tt=$t->num_count();
    if($tt==0)
    {

    $t->username=$name;
    $t->email=$b;
    $t->pass=$c;
    $t->phone=$e;
    $t->save();

    // $ii=new Redirect();
    Redirect::to('register/success');   
    }
    else 
    {
    Redirect::to('register/Notsuccess');
    }

}

我不知道怎么做。你能给我一些建议吗@通过教程学习TreeGardenw,你就会知道如何去做。你不认为如果你想用oop的方式来获取值,你应该创建类和函数来实现吗?是的,我知道。但是我怎样才能以这种格式获取文本框的值?我应该用PHP标记来编写文本框吗@克里斯提·恩杜达斯