1
PHP程式設計討論區 / 回覆: 請教一個簡單的php問題
« 於: 2009-10-20 17:37 »
感謝各位大大熱情相助
正解的確是加個isset就好了
因為沒有定義變數就用...
非常謝謝大家的幫忙~
正解的確是加個isset就好了
因為沒有定義變數就用...
非常謝謝大家的幫忙~

這裡允許您檢視這個會員的所有文章。請注意, 您只能看見您有權限閱讀的文章。
<html>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="type" value=""/>
<input type="submit" name="submit" value="Send" />
</form>
<?php
if($_POST['type']){
echo "input : {$_POST['type']}";
}
?>
</body>
</html>
我的做法
long day = 365;
long mounth = 12;
long second = 1000*3600*24;
long sum = day*mounth*second;
System.out.println("總共"+sum);
不知對不對
ps.我剛來的 很嫩的新手..
import java.io.*;
import java.net.*;
import java.security.Security.*;
import com.sun.net.ssl.*;
import com.sun.*;
public class sslpost {
public static void main(String[] args)throws Exception{
String cuki="";
System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
URL url = new URL("https://login.yahoo.com/config /login?.intl=tw&.pd=c%3d7pP3Kh2p2e4XklntZWWfDLAC8w--&.done=https://tw.login.yahoo.com/cgi-bin/kcookie.cgi/auction/http%3a//tw.bid.yahoo.com/tw");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.addRequestProperty("User-Agent", "Mozilla/4.0");
connection.setRequestMethod("POST");
connection.setFollowRedirects(true);
connection.setDoOutput(true);
OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream(),"ASCII");
out.write("login=xxxx@yahoo.com&passwd=xxxx");
out.write("\r\n");
out.flush();
out.close();
InputStream is = connection.getInputStream();
File f = new File("D://test.htm");
BufferedInputStream bis = new BufferedInputStream(is);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(f));
int c = 0;
while((c=bis.read())!=-1){
bos.write(c);
bos.flush();
}
bos.close();
bis.close();
is.close();
System.out.println("Resp Code:"+connection.getResponseCode());
System.out.println("Resp Message:"+ connection.getResponseMessage());
}
}
改用Firefox吧,他可以看到目前所有的cookie。感謝這位大大,firefox的確可以到cookie的內容
另外,cookie也是header的欄位,所以可以用一些讓你看http header的外掛來看目前設定的cookie。
import java.net.*;
import java.io.*;
public class RetrieveCookies{
public static void main(String[] args)throws Exception{
URL myUrl = new URL("http://tw.page.bid.yahoo.com/tw/auction/1170687196");
URLConnection urlConn = null;
String myCookie = "uid=c4d01b1a-9f52-11dd-8b89-001d096471ea";
myUrl = new URL("http://tw.page.bid.yahoo.com/tw/auction/1170687196");
urlConn = myUrl.openConnection();
urlConn.setRequestProperty("Cookie", myCookie);
urlConn.connect();
InputStream is = urlConn.getInputStream();
File f = new File("D://test.htm");
BufferedInputStream bis = new BufferedInputStream(is);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(f));
int c = 0;
while((c=bis.read())!=-1){
bos.write(c);
bos.flush();
}
bos.close();
bis.close();
is.close();
}
}
>> sb.append("hello");
此行會執行 append 這支方法 (method)
你並沒有宣告出來此支方法...編譯成功是不可能的!!