function showdemo() { $checknumber = array('id' => null); $con = mysql_connect(SAE_MYSQL_HOST_M . ':' . SAE_MYSQL_PORT, SAE_MYSQL_USER, SAE_MYSQL_PASS); if (!$con) { die('Could not connect:' . mysql_error()); } mysql_query("set names utf8"); mysql_select_db(SAE_MYSQL_DB, $con); $getusr = new demo(); $username = $getusr->searchusername(); $sql = "select * from demo order by id desc limit 10"; $res = mysql_query($sql, $con); $result = array(); $num = mysql_num_rows($res); if ($num) { while ($row = mysql_fetch_array($res)) { array_push($result, $row['filetitle'] . '------' . $row['username'] . '---' . $row[time]); } mysql_close($con); return $result; } mysql_close($con); return false; }
public function testExecuteFunction() { $demo = new demo(); $actual = $demo->executeFunction(20); $expected = 40; $this->assertEquals($expected, $actual); }
function demoall($sendrecv5, $sendrecv6) { $demo = new demo(); $finally = $demo->demoall($sendrecv5, $sendrecv6); $demoresult = new filecontroller(); $demoresult->showout($finally); }
private static function get_instance() { if(!isset(self::$_instance)){ self::$_instance = new self(); }else{ return self::$_instance; } }
<?php require 'interface1.php'; class demo implements name { public final function show() { echo "hello"; } } $obj = new demo(); $obj->show();
echo "<div><form id='form4' action='../controller/blog.php' method='post'></div>"; echo "<input type=hidden name=showblog value='showblog'>\n\t <input type=hidden name=blogtitle id=blogtitle value='{$blogres['3']}'></form>"; echo "<div><form id='form5' action='../controller/blog.php' method='post'></div>"; echo "<input type=hidden name=showblog value='showblog'>\n\t <input type=hidden name=blogtitle id=blogtitle value='{$blogres['4']}'></form>"; echo "<div><form id='form6' action='../controller/blog.php' method='post'></div>"; echo "<input type=hidden name=showblog value='showblog'>\n\t <input type=hidden name=blogtitle id=blogtitle value='{$blogres['5']}'></form>"; echo "<div><form id='form7' action='../controller/blog.php' method='post'></div>"; echo "<input type=hidden name=showblog value='showblog'>\n\t <input type=hidden name=blogtitle id=blogtitle value='{$blogres['6']}'></form>"; echo "<div><form id='form8' action='../controller/blog.php' method='post'></div>"; echo "<input type=hidden name=showblog value='showblog'>\n\t <input type=hidden name=blogtitle id=blogtitle value='{$blogres['7']}'></form>"; echo "<div><form id='form9' action='../controller/blog.php' method='post'></div>"; echo "<input type=hidden name=showblog value='showblog'>\n\t <input type=hidden name=blogtitle id=blogtitle value='{$blogres['8']}'></form>"; echo "<div><form id='form10' action='../controller/blog.php' method='post'></div>"; echo "<input type=hidden name=showblog value='showblog'>\n\t <input type=hidden name=blogtitle id=blogtitle value='{$blogres['9']}'></form>"; require_once '../model/demo.php'; $kk = new demo(); $rr = $kk->showdemo(); echo "<div style='left:70px;position:fixed;top:170px;'><a href='javascript:void(0)' onclick='submit(11)'><font color='0000FF'>{$rr['0']}</font></a></div></br>"; echo "<div style='left:70px;position:fixed;top:210px;'><a href='javascript:void(0)' onclick='submit(12)'><font color='0000FF'>{$rr['1']}</font></a></div></br>"; echo "<div style='left:70px;position:fixed;top:250px;'><a href='javascript:void(0)' onclick='submit(13)'><font color='0000FF'>{$rr['2']}</font></a></div></br>"; echo "<div style='left:70px;position:fixed;top:290px;'><a href='javascript:void(0)' onclick='submit(14)'><font color='0000FF'>{$rr['3']}</font></a></div></br>"; echo "<div style='left:70px;position:fixed;top:330px;'><a href='javascript:void(0)' onclick='submit(15)'><font color='0000FF'>{$rr['4']}</font></a></div></br>"; echo "<div style='left:70px;position:fixed;top:370px;'><a href='javascript:void(0)' onclick='submit(16)'><font color='0000FF'>{$rr['5']}</font></a></div></br>"; echo "<div style='left:70px;position:fixed;top:410px;'><a href='javascript:void(0)' onclick='submit(17)'><font color='0000FF'>{$rr['6']}</font></a></div></br>"; echo "<div style='left:70px;position:fixed;top:450px;'><a href='javascript:void(0)' onclick='submit(18)'><font color='0000FF'>{$rr['7']}</font></a></div></br>"; echo "<div style='left:70px;position:fixed;top:490px;'><a href='javascript:void(0)' onclick='submit(19)'><font color='0000FF'>{$rr['8']}</font></a></div></br>"; echo "<div style='left:70px;position:fixed;top:530px;'><a href='javascript:void(0)' onclick='submit(20)'><font color='0000FF'>{$rr['9']}</font></a></div></br>"; echo "<div><form id='form11' action='../controller/files.php' method='post'></div>"; echo "<input type=hidden name=demoall value='demoall'>\n\t <input type=hidden name=filetitle id=filetitle value='{$rr['0']}'></form>"; echo "<div><form id='form12' action='../controller/files.php' method='post'></div>"; echo "<input type=hidden name=demoall value='demoall'>\n\t <input type=hidden name=filetitle id=filetitle value='{$rr['1']}'></form>";
*列出Bucket内所有文件 *递归列出目录下所有文件 */ $prefix = ''; $marker = ''; $delimiter = ''; $next_marker = ''; $maxkeys = 1000; $index = 1; while (true) { $options = array('delimiter' => $delimiter, 'prefix' => $prefix, 'max-keys' => $maxkeys, 'marker' => $next_marker); $res = $Base->getALIOSSSDK()->listObject($Base->getBucketName(), $options); $msg = "列出Bucket内所有文件" . $Base->getBucketName(); if ($res->isOk()) { $body = $res->body; $tmp_object_list = \OSSUtil::get_object_list_marker_from_xml($body, $next_marker); //打印出所有的object名称 foreach ($tmp_object_list as $key) { $data['file'][$index] = $key; $index++; } } if (empty($next_marker)) { break; } } var_dump($data); } } $d = new demo(); $d->run();
<?php class demo { public function display() { echo "you are in the display function"; } } $obj = new demo(); $obj->display();
<?php include './ErrorHandle.class.php'; class demo extends ErrorHandle { public function __construct() { parent::__construct(); } public function test() { throw new Exception("Error Processing Request", 1); //抛出异常 // echo $a; //notice 级别错误 } } $one = new demo(); $one->test(); $one->say(); //调用egister_shutdown_function 注意PHP需要把调用的函数存入内存中,当所有的函数执行完毕之后执行该函数,注意,在这个时候从内存中调用,不是从PHP页面中调用,所以如果有路径信息,应使用绝对路径,因为PHP已经当原来的页面不存在了。就没有什么相对路径可言。注意,在这个时候从内存中调用,不是从PHP页面中调用,所以如果有路径信息,应使用绝对路径,因为PHP已经当原来的页面不存在了。就没有什么相对路径可言。