how to include a php function in a class? -



how to include a php function in a class? -

i have class:

class connect { public function auth() { ... } }

and have function: getfile.php

<?php require_once($globals['path']."connect.php"); ?>

the have the: connect.php

<?php function connect( $host, $database ) { database connection here } ?>

how can utilize functions within class this:

class connect { require_once("getfile.php"); public function auth() { connect( $host, $database ) ... query } }

is possible?

thanks

functions declared in global scope available globally. don't have include need it, include file function in origin of script.

secondly,

class connect { require_once("getfile.php"); public function auth() { connect( $host, $database ) ... query } }

this jibberish; can't execute within class outside of methods. if want included when specific file needed in specific method, this:

class connect { public function auth() { require_once("getfile.php"); connect( $host, $database ) ... query } }

php class function require-once

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -