work with classes in PHP

0

I have a little doubt about how to work with classes in PHP if I have a form called request.php and I have another document called clases.php in which I have all my classes.

but I do not know how to call my file request.php to the class I have in my other file.

request.php :

<div class="form-group">
    <div class="btn-group btn-group-lg">
        <button type="submit" class="btn btn-primary">Continuar</button>
        <?php $object = new GuardarProceso.User;
        print_r($object);?>
        <!--<input type="hidden" name="entradasalida" value="entradasalida" /> -->
    </div>
</div>

clases.php :

class User{
    public $name, $password;
    function save_user(){
        echo "Save User code goes here";
    }
}
    
asked by antonio sanchez 12.09.2018 в 18:43
source

1 answer

2

clase.php

class User{
   public function save_user(){
   echo "hola mundo";
   }
}

request.php

<?php
include('clase.php');
$user = new User;
$variable = $user->save_user();
?>
    
answered by 12.09.2018 в 19:08