我有一个网站,其中的目录设置如下
public_html/framework/cake
public_html/framework/app
public_html/index.php
public_html/contact.php
public_html/aboutus.php
当用户导航到public_html/framework/app
时,有没有办法从public_html/aboutus.php
获取变量或模型数据?
答案 0 :(得分:1)
我建议您阅读HttpSocket documentation。
示例实现看起来类似于:
/**
* import HttpSocket class
*/
App::import('Core', 'HttpSocket');
/**
* instantiate and make a POST request to http://localhost/contact.php
* sending var1 => test
*/
$HttpSocket = new HttpSocket();
$HttpSocket->post('http://localhost/contact.php', array(
array('var1' => 'test')
));
/**
* response
*/
$response = $HttpSocket->response;