Re: [請益] echo
※ 引述《serveto ( )》之銘言:
: 標題: [請益] echo
: 時間: Fri Aug 6 23:29:31 2010
:
: 為何有些函數呼叫要用echo
: 有些不需要?
:
: --
: ※ 發信站: 批踢踢實業坊(ptt.cc)
: ◆ From: 114.44.149.22
: → kosjason:可以說的詳細點嗎 可以舉例嗎 這樣很難答= = 08/07 00:07
http://www.emanueleferonato.com/2008/12/09/sudoku-creatorsolver-with-php/
在這個連結裡的print_sudoku函數
"......
function print_sudoku($sudoku){
$html = "<table bgcolor = \"#000000\" cellspacing = \"1\" cellpadding =
\"2\">";
for($x=0;$x<=8;$x++){
$html .= "<tr bgcolor = \"white\" align = \"center\">";
for($y=0;$y<=8;$y++){
$html.= "<td width = \"20\" height = \"20\">".$sudoku[$x*9+$y]."</td>";
}
$html .= "</tr>";
}
$html .= "</table>";
return $html;
}
...
"
我自己用記事本測試:
"
<?php
function print_sudoku($sudoku){
$html = "<table bgcolor = \"#000000\" cellspacing = \"1\" cellpadding =
\"2\">";
for($x=0;$x<=8;$x++){
$html .= "<tr bgcolor = \"white\" align = \"center\">";
for($y=0;$y<=8;$y++){
$html.= "<td width = \"20\" height = \"20\">".$sudoku[$x*9+$y]."</td>";
}
$html .= "</tr>";
}
$html .= "</table>";
return $html;
}
echo print_sudoku($sudoku);
?>
"
結果有出來9*9方格。而在沒有echo情形下直接print_sudoku()是空白
--
但是最後一個函數solve($sudoku)卻可以直接呼叫?(看網頁裡程式碼最後。)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.44.150.92
※ 編輯: serveto 來自: 114.44.150.92 (08/07 00:21)
推
08/07 00:33, , 1F
08/07 00:33, 1F
→
08/07 00:33, , 2F
08/07 00:33, 2F
→
08/07 00:37, , 3F
08/07 00:37, 3F
→
08/07 00:38, , 4F
08/07 00:38, 4F
※ 編輯: serveto 來自: 114.44.150.92 (08/07 00:53)
→
08/07 00:58, , 5F
08/07 00:58, 5F
→
08/07 00:58, , 6F
08/07 00:58, 6F
推
08/07 01:26, , 7F
08/07 01:26, 7F
→
08/07 01:26, , 8F
08/07 01:26, 8F
→
08/07 02:06, , 9F
08/07 02:06, 9F
討論串 (同標題文章)
PHP 近期熱門文章
PTT數位生活區 即時熱門文章