开发者

Where are PHP model classes defined for use?

开发者 https://www.devze.com 2023-03-30 17:40 出处:网络
I was wondering where functions and classes are defined for php... I remember looking at WordPress source, and they were calling functions without including files, so I\'m curious where this stuff is

I was wondering where functions and classes are defined for php...

I remember looking at WordPress source, and they were calling functions without including files, so I'm curious where this stuff is defined.

What I'm looking at doing putting some connection code, like mysql or like for twilio below

  require "sms/Twilio.php";
  $AccountSid = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
  $AuthToken = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
  $client = new Services_Twilio($AccountSid, $AuthToken);

I'm then thinking of putting just this in a file and including it in many places, but I'm curi开发者_JAVA百科ous if it can get easier than including a file.


You can use __autoload

See http://www.php.net/__autoload


As you're using PHP5, it's best to use spl_autoload_register()

It allows you to assign multiple autoloader methods/functions, but otherwise works in much the same way as __autoload().

0

精彩评论

暂无评论...
验证码 换一张
取 消