半路出家,没有系统学过编程,都是边百度边搞,,百度搞不到就还来烦V友们了,别笑啊
get的话很好理解,比如http://xxx.com?a=1&b=2,不管是传过来还是接受都能理解
比如发送是
<a href="/down.php?A=<?php $A1?>&B=<?php $B1?>">连接</a>
接收页面的话$_GET['A'] or $_GET['B'] 就行了
/**
* 发送post请求
* @param string $url 请求地址
* @param array $post_data post键值对数据
* @return string
*/
function send_post($url, $post_data) {
$postdata = http_build_query($post_data);
$options = array(
'http' =>; array(
'method' =>; 'POST',
'header' =>; 'Content-type:application/x-www-form-urlencoded',
'content' =>; $postdata,
'timeout' =>; 15 * 60 // 超时时间(单位:s)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
post_data = array(
'username' => 'stclair2201',
'password' => 'handan'
);
send_post('http://blog.xxx.com', $post_data);
那么这个又是怎么传递呢,我执行完这些代码,好像没有任何用处啊,怎么会影响到接受页面呢,而且也没有个按钮什么的觉得好奇怪啊
get的话很好理解,比如http://xxx.com?a=1&b=2,不管是传过来还是接受都能理解
比如发送是
<a href="/down.php?A=<?php $A1?>&B=<?php $B1?>">连接</a>
接收页面的话$_GET['A'] or $_GET['B'] 就行了
/**
* 发送post请求
* @param string $url 请求地址
* @param array $post_data post键值对数据
* @return string
*/
function send_post($url, $post_data) {
$postdata = http_build_query($post_data);
$options = array(
'http' =>; array(
'method' =>; 'POST',
'header' =>; 'Content-type:application/x-www-form-urlencoded',
'content' =>; $postdata,
'timeout' =>; 15 * 60 // 超时时间(单位:s)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
post_data = array(
'username' => 'stclair2201',
'password' => 'handan'
);
send_post('http://blog.xxx.com', $post_data);
那么这个又是怎么传递呢,我执行完这些代码,好像没有任何用处啊,怎么会影响到接受页面呢,而且也没有个按钮什么的觉得好奇怪啊