<分区>
我有文件 index.php
,我想在其中包含文件 class.twitter.php
。我该怎么做?
希望当我将下面的代码放入 index.php 时它会起作用。
$t = new twitter();
$t->username = 'user';
$t->password = 'password';
$data = $t->publicTimeline();
<分区>
我有文件 index.php
,我想在其中包含文件 class.twitter.php
。我该怎么做?
希望当我将下面的代码放入 index.php 时它会起作用。
$t = new twitter();
$t->username = 'user';
$t->password = 'password';
$data = $t->publicTimeline();
最佳答案
你的代码应该是这样的
require_once('class.twitter.php');
$t = new twitter;
$t->username = 'user';
$t->password = 'password';
$data = $t->publicTimeline();
关于php - 如何在 PHP 中包含一个类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1994666/