【发布时间】:2014-10-18 14:55:09
【问题描述】:
我在文件夹 (dirC) 中有 gcm...这里是路径
index.php
dirA/
dirB/
dirC/GCM.php
----/config.php
----/sendMsg.php
dirD/
dirE/dirE1/test.php //send from here
dirF/
gcm.php 代码如下
class GCM {
function __construct() {
}
/**
* Sending Push Notification
*/
public function send_notification($registatoin_ids, $message) {
// include config
include_once './config.php';
//other code here
echo 'test';
}
}
我成功地从 sendMsg.php 发送消息,这里是代码
include_once './GCM.php';
$message="hello word";
$gcm = new GCM();
$registatoin_ids = array("SEJFOJOEUJFPUWPJR0923740JEU092308UPUPUAUOJLJLJJVPW634");
$message = array($message);
$result = $gcm->send_notification($registatoin_ids, $message);
echo $result;
我的问题是如何设置路径使用 test.php 的 include_once 与 GCM.php 通信?
这里是test.php代码
include_once './GCM.php'; //my proble is here ???????????
$message="hello word";
$gcm = new GCM();
$registatoin_ids = array("SEJFOJOEUJFPUWPJR0923740JEU092308UPUPUAUOJLJLJJVPW634");
$message = array($message);
$result = $gcm->send_notification($registatoin_ids, $message);
echo $result;
提前谢谢..
【问题讨论】:
-
如果 GCM.php 在另一个目录中,您可以使用 ../ 浏览到该目录(向上一个目录)。
-
2point (../) 和 (./) 有什么区别?
-
../ 是上移一个目录 ./ 是当前目录
标签: php path include include-path