我需要将变量一个页面传递到另一个页面,我需要将数据传递到另一个文件我必须将该数据传递到另一个文件中请一些人帮助我。我想通过变量product.php文件来解决问题。 php文件请帮忙。 这是我的product.php文件代码:
//--------Post image-------///
if (isset($this->request->post['image'])) {
$data['image'] = $this->request->post['image'];
}
$images2 = "http://localhost/mspink_new/image/".$data['image'];
//print_r($images2);die;
//--------Post image-------//
//-------------curl starting---------------//
$url = 'http://localhost/mspink_new/pintest.php';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS,$images2);
$result = curl_exec($ch);
print_r($result);die;
curl_close($ch);
//-------------curl clossing---------------//
这是我的pinterest.php文件:
$images = $_POST['image'];
require_once "Pinterest.class.php";
$p = new Pinterest();
$p->login("username", "password");
if( $p->is_logged_in() )
echo "Success, we're logged in\n";
$image =$images;
$p->pin_url = "http://www.websitname/";
$p->pin_description = "My awesome pin";
$p->pin_image_preview = $p->generate_image_preview('slider.jpg');
// Get the boards
$p->get_boards();
// Pin to the board called "Items"
if( !isset($p->boards['Items']) ) {
echo "For testing, please create a board called 'Items' and try again!\n";
exit;
}
$p->pin($p->boards['Items']);
// And we're done
echo "Hooray!\n";
答案 0 :(得分:0)
首先,请注意您引用文件pinterest.php的不同名称。在你的卷曲中,你打电话给... / pintest.php,你说你的文件名为pinterest.php
其次,你不必要地重新分配这个变量。
$image =$images;
在我的情况下,我最好包含/ require_once pinterest.php文件:
// Post image
if (isset($this->request->post['image'])){ $data['image'] = $this->request->post['image'];
include('pintest.php');
}