使用在不同文件中声明的函数[PHP-HTML]

Good morning, i'm trying to make a responsive web page, though the combined use of Html5, css3 and php 7.2 (configured with microsoft SqlServer-2008-R2, because the company has the database stored there yet). Now, i'm trying to make it modular, so i want to have:

  • Home.php (with the html structure of the page),
  • Styles.css (with the style of the page),
  • Classes.php (with all the declarations of classes and functions that Home.php can call and use while needed, like OpenConnection etc...).

The problem is that i can't call the functions from the classes.php file. I'm trying to open the connection to our server but it doesn't work.

this is my actual code for the Classes.php file:

<?php 
class Connessioni {

    function apriConn ($srv, $db){
        /* Get UID and PWD from application-specific files.  */
        $uid = file_get_contents("C:\inetpub\wwwroot\MoviDex\Parametri\UidPwd\uid.txt");
        $pwd = file_get_contents("C:\inetpub\wwwroot\MoviDex\Parametri\UidPwd\pwd.txt");
        $connectionInfo = array( "UID"=>$uid,
                                 "PWD"=>$pwd,
                                 "Database"=>$db);
        try {
          $conn = new PDO( "sqlsrv:server=".$srv.";Database = ".$db, $uid, $pwd);
          $conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
        }
        catch( PDOException $e ) {
            die( "Error connecting to SQL Server" );
        }

        echo "Connected to SQL Server
";
        return $conn;
}
?>

and this is how i call it from the Home.php:

<table class="w3-table-all w3-hoverable w3-card-4 ">
<?php
require (classes.php);
$serverName = "xxx.xxx.x.x";
$database = "EDP";
$conn= apriConn($serverName, $database);

$query = "My query, that it does work, i've used it yet directly in sql server";

$stmt = $conn->query( $query );
while ( $row = $stmt->fetch( PDO::FETCH_ASSOC ) ){
     print_r( $row );
}

// Free statement and connection resources.
$stmt = null;
$conn = null;
?>
</table>

Can you please help me ? thank you so much.