php¿ò¼ÜcodeigniterÊý¾Ý¿â²Ù×÷ÕûÀí
Tag:¡¡¡¡
-
1.
$query = $this->db->query('SELECT name, title, email from my_table');
foreach ($query->result() as $row)
{
echo $row->title;
echo $row->name;
echo $row->email;
}
2.
foreach ($query->result_array() as $row)
{
echo $row['title'];
echo $row['name'];
echo $row['email'];
}
3.
if ($query->num_rows() > 0)
4.
$query = $this->db->query('SELECT name from my_table LIMIT 1');
$row = $query->row();//$row = $query->row_array();
echo $row->name;
Äã¿ÉÒÔ´«µÝ²ÎÊýÒÔ±ã»ñµÃijһÐеÄÊý¾Ý¡£±ÈÈçÎÒÃÇÒª»ñµÃµÚ 5 ÐеÄÊý¾Ý£º
$row = $query->row_array(5);
³ý´ËÒÔÍâ, ÎÒÃÇ»¹¿ÉÒÔʹÓÃÏÂÃæµÄ·½·¨Í¨¹ýÓαêµÄ·½Ê½»ñÈ¡¼Ç¼£º
$row = $query->first_row()
$row = $query->last_row()
$row = $query->next_row()
$row = $query->previous_row()
5.
$sql = "INSERT INTO mytable (title, name)
VALUES (".$this->db->escape($title).", ".$this->db->escape($name).")";
$this->db->query($sql);//$query = $this->db->get('table_name');
echo $this->db->affected_rows();
6.
$data = array(
'title' => $title,
'name' => $name,
'date' => $date
);
$this->db->insert('mytable', $data);
// Produces: INSERT INTO mytable (title, name, date) VALUES ('{$title}', '{$name}', '{$date}')
7.
$this->db->escape()
8.
$sql = "SELECT * from some_table WHERE id = ? AND status = ? AND author = ?";
$this->db->query($sql, array(3, 'live', 'Rick')); //×Ô¶¯×ªÒå
9.
¸Ãº¯Êý·µ»Øµ±Ç°ÇëÇóµÄ×Ö¶ÎÊý£¨ÁÐÊý£©£º
$query = $this->db->query('SELECT * from my_table');
echo $query->num_fields();
10.
$query = $this->db->query('SELECT title from my_table');
foreach ($query->result() as $row)
{
echo $row->title;
}
$query->free_result(); // $query ½«²»ÔÙ¿ÉÓÃ
$query2 = $this->db->query('SELECT name from some_table');
$row = $query2->row();
echo $row->name;
$query2->free_result(); // $query2 ½«²»ÔÙ¿ÉÓÃ
11.
$this->db->
Ïà¹ØÎĵµ£º
__autoload($classname){
}
µ±PHPÕÒ²»µ½ÀàÎļþ»áµ÷ÓÃÕâ¸ö·½·¨£¬µ±×¢²áÁË×Ô¼ºµÄº¯Êý»ò·½·¨Ê±£¬PHP²»»áµ÷ÓÃ__autoload()º¯Êý£¬¶ø»áµ÷ÓÃ×Ô¶¨ÒåµÄº¯Êý
spl_autoload_register('func_name');
spl_autoload_register(array('class_name','method_name')); ......
½ñÌì¸ø´ó¼Ò½éÉܵÄÊÂÒ»¿îÀ´×ÔÃÀ¹úµÄºÀ»ªÖ÷»ú¿Õ¼ä£¬¿Õ¼äÀàÐÍÊÇPHPµÄ£¬ËٶȺܿ죬Ö÷»úÅäÖÃÒ²ºÜºÃ£¨4CPU£©£¡
Ïл°²»ËµÁË£¬¿´Ãâ·Ñ¿Õ¼ä½éÉÜ°É£º
¿Õ¼ä´óС£º5GB
ÔÂÁ÷Á¿£º10GB
Ãâ·ÑMySQLÊý¾Ý¿â£º ÎÞÏÞÖÆ
Ö§³Ö½Å±¾£ºCGI£¬ PHP£¬ FrontPage Extensions£¬ Perl£¬ Python.
Ö§³ÖFTP
Ö§³ÖÓòÃû°ó¶¨
ÓÐÃâ·ÑÓʾ֣¬ÊÇcPanelÃæ°åµÄ£¬Ö§ ......
×î½ü¹¤×÷ÖÐÓöµ½Ò»¸öÍ·ÌÛµÄÎÊÌâ:phpÖе÷ÓÃÒ»¸ö´æ´¢¹ý³Ì(Òª¸´ÖÆN¶àÊý¾ÝµÄ.),ÓÉÓڴ˹ý³ÌÖ´ÐÐʱ¼äºÜ³¤.µ¼ÖÂphp×ÜÊdz¬Ê±´íÎó:
Service Temporarily Unavailable
The
server is temporarily unable to service your request due to maintenance downtime
or capacity problems
.
Please
try
again
later
.
ÎÊÌ ......
ÓÃphp»ñÈ¡±¾ÖÜ,ÉÏÖÜ,±¾ÔÂ,ÉÏÔÂ,±¾¼¾¶ÈÈÕÆڵĴúÂë,Ö÷ÒªÓõ½date,strtotimeºÍmktimeº¯Êý.
echo date("Ymd",strtotime("now")), "<br />";
echo date("Ymd",strtotime("-1 week Monday")), "<br />";
echo date("Ymd",strtotime("-1 week Sunday")), "<br />";
echo date("Ymd",strtotime("+0 week ......
php -h¿ÉÒÔ»ñÈ¡°ïÖúÐÅÏ¢¡£PHP°æ±¾ºÅÐÅÏ¢£º/your_current_path/php -v£¬PHPÔËÐнű¾£º/your_current_path/php your_file_path£¬PHPÔËÐÐÓï¾ä/your_current_path/php -r your_code_snippet¡£
´úÂëÖ´ÐнáÊøºó£¬PHP»á¸ù¾Ý¾ßÌåÖ´ÐÐÇé¿ö×Ô¶¯µÄÊÍ·Å£¬Èç¹ûÖ´Ðйý³ÌÖÐÄÚ´æÏûºÄ½Ï´ó£¬¿ÉÒÔÀûÓÃNULL»òunsetÀ´ÊÍ·ÅÄÚ´æ¡£Çø±ðÔÚÓÚ£¬Ç°Õß ......