* @author Administrator * @package defaultPackage * @rcsfile $RCSfile: index.php,v $ * @revision $Revision: 1.1 $ * @date $Date: 2009/08/04 04:06:20 $ */ require_once dirname(__FILE__) . '/include/common.inc.php'; require_once dirname(__FILE__) . '/include/asktype.inc.php'; $nav = $sitename; $solvingnum = 0; //未解决的问题数 $solvednum = 0; //已解决的问题数 $query = "select status,count(status) as dd from `#@__ask` group by status "; $dsql->Execute('me', $query); while ($tmparr = $dsql->GetArray()) { if ($tmparr['status'] == 0) { $solvingnum = $tmparr['dd']; } else { $solvednum += $tmparr['dd']; } } $dtp = new DedeTemplate(); $dtp->LoadTemplate(DEDEASK . 'template/default/index.htm'); if ($cfg_ask_rewrite == 'Y') { $dtp->Display(); myecho(); exit; } else { $dtp->Display(); }
myecho("create"); socket_bind($sock, $address, $port); myecho("bind"); socket_listen($sock, 1); myecho("listen"); $msgsock = socket_accept($sock); myecho("accept"); $n = 0; $req = ''; while (true) { $data = socket_read($msgsock, 2048, PHP_NORMAL_READ); if ($data === '' or $data === false) { if ($data === '') { myecho("socket_read - empty data"); } else { myecho("socket_read - false"); } break; } $req .= $data; sleep(1); $n++; if ($n === 5) { break; } } file_put_contents('req.txt', $req); $msg = "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n4\r\nWiki\r\n5\r\npedia\r\n"; socket_write($msgsock, $msg, strlen($msg)); for ($i = 0; $i < 5; $i++) { echo $i, ": ";
<?php ## Использование func_get_args(). function myecho() { foreach (func_get_args() as $v) { echo "{$v}<br />\n"; // выводим элемент } } // отображаем строки одну под другой myecho("Меркурий", "Венера", "Земля", "Марс");
<?php function myecho() { foreach (func_get_args() as $v) { echo "{$v}<br>\n"; } } myecho("привет", "я", "прикольный", "диназавр", "по", "имени", "хуй", ".");