==O:3:"Car":1:{s:4:"name";s:7:"new car";}
object(Car)#3 (1) {
["name"]=>
string(7) "new car"
}
object(Car)#3 (1) {
["name"]=>
string(7) "new car"
}
2015-10-02
$res = mysql_query('select * from user limit 1');
$row = mysql_fetch_assoc($res);
var_dump($row);
$row = mysql_fetch_assoc($res);
var_dump($row);
2015-10-01
$link = mysql_connect($host,$user,$pass);
mysql_select_db('code1');
mysql_query("set names 'utf8'");
$res = mysql_query('select * from fuck');
print_r(mysql_fetch_row($res));
mysql_select_db('code1');
mysql_query("set names 'utf8'");
$res = mysql_query('select * from fuck');
print_r(mysql_fetch_row($res));
2015-10-01
if (file_exists($fn)) {//如果文件存在
echo 'Successed!<br>';
file_put_contents($fn,'nihao');
echo file_get_contents($fn);
}
else{//否则重建
echo 'Failed!';
$counter_file = '/data/webroot/usercode/code/test2.txt';
$fn = fopen($counter_file,'wb');
file_put_contents($fn,'nihao');
echo file_get_contents($fn);
}
echo 'Successed!<br>';
file_put_contents($fn,'nihao');
echo file_get_contents($fn);
}
else{//否则重建
echo 'Failed!';
$counter_file = '/data/webroot/usercode/code/test2.txt';
$fn = fopen($counter_file,'wb');
file_put_contents($fn,'nihao');
echo file_get_contents($fn);
}
2015-09-28
$filename = '/data/webroot/usercode/code/test2.txt';
if (file_exists($filename)) {
echo 'Successed!<br>';
echo file_get_contents($filename);
}
else{
echo 'Failed!';
}
if (file_exists($filename)) {
echo 'Successed!<br>';
echo file_get_contents($filename);
}
else{
echo 'Failed!';
}
2015-09-28
$filename = '/data/webroot/usercode/code/resource/test.txt';
//编写代码读取$filename的文件内容
$content = file_get_contents($filename);
echo $content;
//编写代码读取$filename的文件内容
$content = file_get_contents($filename);
echo $content;
2015-09-28
$p = '/\w+@\w+\.\w+/';
preg_match($p,$subject,$matchs);
print_r($matchs);
preg_match($p,$subject,$matchs);
print_r($matchs);
2015-09-28