ホームページ バックエンド開発 PHPチュートリアル php実践_PHPチュートリアル2日目

php実践_PHPチュートリアル2日目

Jul 14, 2016 am 10:10 AM
add function php 優れた 書く 戻る 実戦 影響 方法 に追加 伝言板 戻る



1. 掲示板に追加方法を書きました


[php] 関数 add(){
//追加後、影響を受けるアイテムの数を返します。0 より大きい場合、追加が成功したことを意味します
If($this->db->data($_POST)->add()>0){
「正常に追加されました」をエコーし​​ます
; // echo "<script>location.reload()</script>";//更新されたフォームの繰り返し送信を防止します
Header("HTTP/1.1 303 その他を参照"); Header("Location: "); // ルートディレクトリにリダイレクトします
出る

}その他{
die($this->db->error());//失敗出力エラーメッセージを追加
                                                                             }

関数add(){

//追加後、影響を受けるアイテムの数を返します。それが 0 より大きい場合、追加は成功したことを意味します

If($this->db->data($_POST)->add()>0){
echo "正常に追加されました";
//echo "<script>location.reload()</script>";//更新されたフォームを繰り返し送信しないようにします
Header("HTTP/1.1 303 その他を参照");
Header("Location: ") //ルートディレクトリにリダイレクトします
終了します;

}その他{
Die($this->db->error());//失敗時の出力エラーメッセージを追加
}
}対応する投稿フォーム


[html] 

 
   
 
         
                         
                             
                             
                         
                         
                             
                             
                         
                         
                             
                             
                         
                         
                             
                             
                         
       
用户名
留言内容
电子邮箱email:
 
             
                     
               
 
           
 
 


 

   
                       
                           
                           
                       
                       
                           
                           
                       
                       
                           
                           
                       
                       
                           
                           
                       
  
用户名
留言内容
电子邮箱email:

           
                   
               

   

2. 渡されたデータを自動的に処理し、フィールドが存在しない場合は追加されないように MYSQL 操作クラスを変更しました。


[php] // +---------------------------------------------- --- ----------------------------------
// |MySQL 操作クラス
// +---------------------------------------------- --- ----------------------------------
// |@微冰QQ:496928838
// +---------------------------------------------- --- ----------------------------------
クラス MySQL{

プライベート $db_mysql_hostname
プライベート $db_mysql_username
プライベート $db_mysql_password
プライベート $db_mysql_database
プライベート $db_mysql_port
プライベート $db_mysql_charset

プライベート $query_list = array();
//クエリ数
パブリック $query_count = 0; //クエリ開始時刻
公開 $query_start_time

//現在のクエリID
保護された $クエリ ID
//現在の接続
保護された $conn
// トランザクション命令の数
保護された $transTimes = 0; // レコード数を返すか、レコード数に影響を与える
保護された $numRows = 0; // エラーメッセージ
保護された $error = '';
パブリック関数 __construct($hostname_or_conf,$username,$password,$database,$port = '3306',$char = 'utf8'){
If(is_array($hostname_or_conf)){
$this->db_mysql_hostname = $hostname_or_conf['hostname']; $this->db_mysql_username = $hostname_or_conf['username']; $this->db_mysql_password = $hostname_or_conf['パスワード']; $this->db_mysql_database = $hostname_or_conf['database']; $this->db_mysql_port = isset($hostname_or_conf['port'])?$hostname_or_conf['port']:'3306'; $this->db_mysql_charset = isset($hostname_or_conf['charset'])?$hostname_or_conf['charset']:'utf8';                                           }elseif(!empty($hostname_or_conf)||!empty($username)||!empty($password)||!empty($database))
                                                            $this->db_mysql_hostname = $hostname_or_conf; $this->db_mysql_username = $username; $this->db_mysql_password = $password; $this->db_mysql_database = $database; $this->db_mysql_port = $port; $this->db_mysql_charset = $char;                                             }その他{
die('設定エラー。'); }
$this->connect(); }

プライベート関数 connect(){
$server = $this->db_mysql_hostname.':'.$this->db_mysql_port;        $this->conn = mysql_connect($server,$this->db_mysql_username,$this->db_mysql_password,true) または die('MySQL DB 接続エラー!'); 
        mysql_select_db($this->db_mysql_database,$this->conn) または die('select db error!'); 
        mysql_query("セット名 " . $this->db_mysql_charset, $this->conn); 
    }
    /**
+------------------------------------------------ ----------
*データオブジェクトの値を設定します
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
*テーブル、場所、順序、制限、データ、フィールド、結合、グループ、所有
+------------------------------------------------ ----------
​​*/
    パブリック関数テーブル($table){
        $this->query_list['table'] = $table; 
        $this を返します。 
    }
     
    パブリック関数 where($where){
        $this->query_list['where'] = $where; 
        $this を返します。 
    }
     
    公共機能注文($order){
        $this->query_list['order'] = $order; 
        $this を返します。 
    }
     
    パブリック関数の制限($offset,$length){
        if(!isset($length)){
            $length = $offset; 
            $オフセット = 0; 
        }
        $this->query_list['limit'] = '制限 '.$offset.','.$length; 
        $this を返します。 
    }
     
    パブリック関数データ($data){
        //读取データベース表字段、その後処理表单データベース
        $dataList = $this->getFields($this->query_list['table']); 
        $arr=配列(); 
        foreach ($dataList as $key=>$value) {
            if (array_key_exists ($key,$data) ) {
                $arr[$key]=$data[$key]; 
            }
             
        }
        //var_dump($arr);  
        /*
        if(is_object($data)){
            $data = get_object_vars($data);
        }elseif (is_string($data)){
            parse_str($data,$data);
        }elseif(!is_array($data)){
            //ログ:DATA_TYPE_INVALID
        }
        */
        $this->query_list['data'] = $arr; 
        $this を返します。 
    }
    パブリック関数フィールド($fields){
        $this->query_list['fields'] = $fields; 
        $this を返します。 
    }
    パブリック関数結合($join){
        $this->query_list['join'] = $join; 
        $this を返します。 
    }
    パブリック関数グループ($group){
        $this->query_list['group'] = $group; 
        $this を返します。 
    }
    パブリック関数 have($having){
        $this->query_list['having'] = $having; 
        $this を返します。 
    }
    /**
+------------------------------------------------ ----------
* クエリ
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param
+------------------------------------------------ ----------
​​*/
    パブリック関数 select(){
        $select_sql = '選択'; 
        $fields = isset($this->query_list['fields'])?$this->query_list['fields']:'*'; 
        $select_sql.=$fields; 
        $select_sql.= ' from `'.$this->query_list['table'].'` '; 
         
        isset($this->query_list['join'])?($select_sql.=$this->query_list['join']):''; 
        isset($this->query_list['where'])?($select_sql.=' where '.$this->query_list['where']):''; 
        isset($this->query_list['group'])?($select_sql.=' group by'.$this->query_list['group']):''; 
        isset($this->query_list['having'])?($select_sql.=' mysql を持つ '.$this->query_list['having']):''; 
        isset($this->query_list['order'])?($select_sql.=' order by '.$this->query_list['order']):''; 
        isset($this->query_list['limit'])?($select_sql.=' '.$this->query_list['limit']):''; 
         
        return $this->query($select_sql); 
    }
    /**
+------------------------------------------------ ----------
*
を追加 +------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param
+------------------------------------------------ ----------
​​*/
    パブリック関数 add(){
        $add_sql = '`' に挿入します。$this->query_list['table'].'` (';
         
        $data = $this->query_list['data']; 
        $値 = $フィールド = ''; 
        foreach($data as $k=>$v){
            $field .= '`'.$k.'`,'; 
            if(is_numeric($v))
                $value .= $v.','; 
            その他
                $value .= '''.$v.'','; 
        }
        $add_sql .= rtrim($field,',').') 値 ('.rtrim($value,',').')'; 
 
    // echo 'add_sql'.$add_sql;  
        return $this->execute($add_sql); 
    }
    /**
+------------------------------------------------ ----------
*削除
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param
+------------------------------------------------ ----------
​​*/
    パブリック関数 delete(){
        $del_sql = '`.$this->query_list['table'].'` から削除します。where '.$this->query_list['where']; 
         
        if(isset($this->query_list['order']))
            $del_sql .= 'order by '.$this->query_list['order']; 
        if(isset($this->query_list['limit']))
            $del_sql .= ' '.$this->query_list['limit']; 
             
        return $this->execute($del_sql); 
         
    }
    /**
+------------------------------------------------ ----------
*更新
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param
+------------------------------------------------ ----------
​​*/
    パブリック関数 update(){
        $update_sql = 'update `'.$this->query_list['table'].'` set '; 
        $data = $this->query_list['data']; 
         
        foreach($data as $k=>$v){
            if(is_numeric($v))
                $update_sql .= '`'.$k.'` ='.$v.','; 
            その他
                $update_sql .= ''.$k.'' =''.$v.'','; 
        }
        $update_sql = rtrim($update_sql,','); 
        if(isset($this->query_list['where']))
            $update_sql .= ' where '.$this->query_list['where']; 
        if(isset($this->query_list['order']))
            $update_sql .= ' order by '.$this->query_list['order']; 
        if(isset($this->query_list['limit']))
            $update_sql .= ' '.$this->query_list['limit']; 
         
        return $this->execute($update_sql); 
         
    }
     /**
     +------------------------------------------------ --------
     * 実行查询 返回数据集
     +------------------------------------------------ --------
     * @アクセス公開
     +------------------------------------------------ --------
     * @param string $sql sql命令
     */
    パブリック関数クエリ($sql) {
        if ( !$this->conn ) は false を返します。 
        $this->queryStr = $sql; 
        //释放前回の查询結果
        if ( $this->queryID ) { $this->free();    }
         
        $this->query_start_time = microtime(true); 
         
        $this->queryID = mysql_query($sql, $this->conn); 
        $this->query_count++; 
        if ( false === $this->クエリID ) {
            $this->error(); 
            false を返します。 
        } その他 {
            $this->numRows = mysql_num_rows($this->queryID); 
            $this->getAll(); を返す 
        }
    }
    /**
+------------------------------------------------ ----------
* ステートメントを実行します
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param string $sql SQLコマンド
+------------------------------------------------ ----------
​​*/
    パブリック関数実行($sql) {
        if ( !$this->conn ) は false を返します。 
        $this->queryStr = $sql; 
        //释放前回の查询結果
        if ( $this->queryID ) { $this->free();    }
         
        $this->query_start_time = microtime(true); 
         
        $result = mysql_query($sql, $this->conn) ; 
        $this->query_count++; 
        if ( false === $result) {
            $this->error(); 
            false を返します。 
        } その他 {
            $this->numRows = mysql_affected_rows($this->conn); 
            $this->numRows を返します; 
        }
    }
    /**
+------------------------------------------------ ----------
* すべてのクエリデータを取得します
+------------------------------------------------ ----------
* @アクセス非公開
+------------------------------------------------ ----------
* @return 配列
​​*/
    プライベート関数 getAll() {
        // 返される回数データ集
        $result = 配列(); 
        if($this->numRows>0) {
            while($row = mysql_fetch_assoc($this->クエリID)){
                $result[] = $row; 
            }
            mysql_data_seek($this->クエリID,0); 
        }
        $result を返します。 
    }
    /**
+------------------------------------------------ ----------
* データテーブルのフィールド情報を取得します
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
​​*/
    パブリック関数 getFields($tableName) {
        $result = $this->query('SHOW COLUMNS FROM `'.$tableName.'`'); 
        $info = 配列(); 
        if($result) {
            foreach ($result as $key => $val) {
                $info[$val['フィールド']] = array(
                    「名前」 => $val['フィールド']、
                    「タイプ」 => $val['タイプ'],
                    'notnull' => (bool) ($val['Null'] === ''), // null 以外は空、null ははい
                    'デフォルト' => $val['デフォルト']、
                    'プライマリ' => (strto lower($val['Key']) == 'pri'),
                    'autoinc' => (strto lower($val['Extra']) == 'auto_increment'),
                ); 
            }
        }
        $info を返します。 
    }
    /**
+------------------------------------------------ ----------
* データベースのテーブル情報を取得します
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
​​*/
    パブリック関数 getTables($dbName='') {
        if(!empty($dbName)) {
           $sql = '.$dbName からのテーブルを表示; 
        }その他{
           $sql = 'テーブルの表示 '; 
        }
        $result = $this->query($sql); 
        $info = 配列(); 
        foreach ($result as $key => $val) {
            $info[$key] = 現在($val); 
        }
        $info を返します。 
    }
 
    /**
     +------------------------------------------------ --------
     *最後に操作したID
     +------------------------------------------------ --------
     * @アクセス公開
     +------------------------------------------------ --------
     * @param
     +------------------------------------------------ --------
     */
     パブリック関数 last_insert_id(){
        return mysql_insert_id($this->conn); 
    }
    /**
* 結果セット数を指定して
を実行する ​​*/
    パブリック関数カウント($sql){
        return $this->execute($sql); 
    }
    /**
+------------------------------------------------ ----------
* 取引を開始します
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @return void
+------------------------------------------------ ----------
​​*/
    パブリック関数 startTrans() {
        if ($this->transTimes == 0) {
            mysql_query('トランザクションの開始', $this->conn); 
        }
        $this->transTimes++; 
        戻る ; 
    }
 
    /**
+------------------------------------------------ ----------
* トランザクションを送信します
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @return boolen
+------------------------------------------------ ----------
​​*/
    パブリック関数 commit()
    {
        if ($this->transTimes > 0) {
            $result = mysql_query('COMMIT', $this->conn); 
            $this->transTimes = 0; 
            if(!$result){
                throw new Exception($this->error()); 
            }
        }
        true を返します。 
    }
 
    /**
+------------------------------------------------ ----------
* トランザクションのロールバック
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @return boolen
+------------------------------------------------ ----------
​​*/
    パブリック関数 rollback()
    {
        if ($this->transTimes > 0) {
            $result = mysql_query('ROLLBACK', $this->conn); 
            $this->transTimes = 0; 
            if(!$result){
                throw new Exception($this->error()); 
            }
        }
        true を返します。 
    }
    /**
+------------------------------------------------ ----------
* エラーメッセージ
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param
+------------------------------------------------ ----------
​​*/
     パブリック関数 error() {
        $this->error = mysql_error($this->conn); 
        if('' != $this->queryStr){
            $this->error .= "n [ SQL语句 ] : ".$this->queryStr; 
        }
        $this->エラーを返します; 
    }
    /**
+------------------------------------------------ ----------
* クエリ結果をリリース
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
​​*/
    public function free() {
        @mysql_free_result($this->クエリID); 
        $this->クエリID = 0; 
        $this->query_list = null; 
    }
    /**
+------------------------------------------------ ----------
*接続を閉じる
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param
+------------------------------------------------ ----------
​​*/
    関数 close(){
        if ($this->conn && !mysql_close($this->conn)){
            throw new Exception($this->error()); 
        }
        $this->conn = 0; 
        $this->クエリカウント = 0; 
    }
    /**
+------------------------------------------------ ----------
*破壊方法
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
​​*/
    関数 __destruct(){
         $this->close(); 
    }
}

// +---------------------------------------------- --- ----------------------------------
// |MySQL 操作クラス
// +---------------------------------------------- --- ----------------------------------
// |@微梁QQ:496928838
// +---------------------------------------------- --- ----------------------------------
クラスMySQL{

プライベート $db_mysql_hostname;
プライベート $db_mysql_username;
プライベート $db_mysql_password;
プライベート $db_mysql_database;
プライベート $db_mysql_port;
プライベート $db_mysql_charset;

プライベート $query_list = array();

//クエリ数
パブリック $query_count = 0;
//クエリ開始時刻
public $query_start_time;

//現在のクエリID
保護された $queryID;
//現在の接続
保護された $conn;
//トランザクション命令の数
保護された $transTimes = 0;
//レコード数を返すか、レコード数に影響を与えます
保護された $numRows = 0;
// エラーメッセージ
protected $error = '';

パブリック関数 __construct($hostname_or_conf,$username,$password,$database,$port = '3306',$char = 'utf8'){
if(is_array($hostname_or_conf)){
$this->db_mysql_hostname = $hostname_or_conf['hostname'];
$this->db_mysql_username = $hostname_or_conf['username'];
$this->db_mysql_password = $hostname_or_conf['パスワード'];
$this->db_mysql_database = $hostname_or_conf['データベース'];
$this->db_mysql_port = isset($hostname_or_conf['port'])?$hostname_or_conf['port']:'3306';
$this->db_mysql_charset = isset($hostname_or_conf['charset'])?$hostname_or_conf['charset']:'utf8';

}elseif(!empty($hostname_or_conf)||!empty($username)||!empty($password)||!empty($database))
{
$this->db_mysql_hostname = $hostname_or_conf;
$this->db_mysql_username = $username;
$this->db_mysql_password = $password;
$this->db_mysql_database = $database;
$this->db_mysql_port = $port;
$this->db_mysql_charset = $char;

}その他{
Die('設定エラー。');
}
$this->connect();
}

プライベート関数 connect(){
$server = $this->db_mysql_hostname.':'.$this->db_mysql_port;
$this->conn = mysql_connect($server,$this->db_mysql_username,$this->db_mysql_password,true) または die('MySQL DB 接続エラー!');
mysql_select_db($this->db_mysql_database,$this->conn) または die('select db error!');
mysql_query("セット名 " . $this->db_mysql_charset, $this->conn);
}
/**
+------------------------------------------------ ----------
*データオブジェクトの値を設定します
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
*テーブル、場所、順序、制限、データ、フィールド、結合、グループ、所有
+------------------------------------------------ ----------
​​*/
パブリック関数テーブル($table){
$this->query_list['table'] = $table;
$this を返します;
}

パブリック関数 where($where){
$this->query_list['where'] = $where;
$this を返します;
}

パブリック関数の順序($order){
$this->query_list['order'] = $order;
$this を返します;
}

パブリック関数の制限($offset,$length){
if(!isset($length)){
$length = $offset;
$オフセット = 0;
}
$this->query_list['limit'] = '制限 '.$offset.','.$length;
$this を返します;
}

 パブリック関数データ($data){
  //データデータ表フィールドを读取し、その後処理表单データセット
  $dataList = $this->getFields($this->query_list['table']);
  $arr=array();
  foreach ($dataList as $key=>$value) {
   if (array_key_exists ($key,$data) ) {
    $arr[$key]=$data[$key];
   }
   
  }
  //var_dump($arr);
  /*
  if(is_object($data)){
   $data = get_object_vars($data);
  }elseif (is_string($data)){
   parse_str($data,$data);
  }elseif(!is_array($data)){
   //ログ:DATA_TYPE_INVALID
  }
  */
  $this->query_list['data'] = $arr;
  $this を返します;
 }
 パブリック関数フィールド($fields){
  $this->query_list['fields'] = $fields;
  $this を返します;
 }
 パブリック関数 join($join){
  $this->query_list['join'] = $join;
  $this を返します;
 }
 パブリック関数グループ($group){
  $this->query_list['group'] = $group;
  $this を返します;
 }
 パブリック関数having($having){
  $this->query_list['having'] = $having;
  $this を返します;
 }
 /**
+------------------------------------------------ ----------
* クエリ
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param
+------------------------------------------------ ----------
​​*/
 パブリック関数 select(){
  $select_sql = '選択';
  $fields = isset($this->query_list['fields'])?$this->query_list['fields']:'*';
  $select_sql.=$fields;
  $select_sql.= ' from `'.$this->query_list['table'].'` ';
  
  isset($this->query_list['join'])?($select_sql.=$this->query_list['join']):'';
  isset($this->query_list['where'])?($select_sql.=' where '.$this->query_list['where']):'';
  isset($this->query_list['group'])?($select_sql.=' group by'.$this->query_list['group']):'';
  isset($this->query_list['having'])?($select_sql.=' mysql を持つ '.$this->query_list['having']):'';
  isset($this->query_list['order'])?($select_sql.=' order by '.$this->query_list['order']):'';
  isset($this->query_list['limit'])?($select_sql.=' '.$this->query_list['limit']):'';
  
  return $this->query($select_sql);
 }
 /**
+------------------------------------------------ ----------
*
を追加 +------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param
+------------------------------------------------ ----------
​​*/
 パブリック関数 add(){
  $add_sql = '`' に挿入します。$this->query_list['table'].'` (';
  
  $data = $this->query_list['data'];
  $value = $field = '';
  foreach($data as $k=>$v){
   $field .= '`'.$k.'`,';
   if(is_numeric($v))
    $value .= $v.',';
   それ以外
    $value .= '''.$v.'',';
  }
  $add_sql .= rtrim($field,',').') 値 ('.rtrim($value,',').')';

// エコー 'add_sql'.$add_sql;
  return $this->execute($add_sql);
 }
 /**
+------------------------------------------------ ----------
*削除
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param
+------------------------------------------------ ----------
​​*/
 パブリック関数 delete(){
  $del_sql = '「.$this->query_list['table'].'` から削除します。」 where '.$this->query_list['where'];
  
  if(isset($this->query_list['order']))
   $del_sql .= 'order by '.$this->query_list['order'];
  if(isset($this->query_list['limit']))
   $del_sql .= ' '.$this->query_list['limit'];
   
  return $this->execute($del_sql);
  
 }
 /**
+------------------------------------------------ ----------
*更新
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param
+------------------------------------------------ ----------
​​*/
 パブリック関数 update(){
  $update_sql = '更新 `'.$this->query_list['テーブル'].'` セット ';
  $data = $this->query_list['data'];
  
  foreach($data as $k=>$v){
   if(is_numeric($v))
    $update_sql .= '`'.$k.'` ='.$v.',';
   それ以外
    $update_sql .= ''.$k.'' =''.$v.'',';
  }
  $update_sql = rtrim($update_sql,',');
  if(isset($this->query_list['where']))
   $update_sql .= ' where '.$this->query_list['where'];
  if(isset($this->query_list['order']))
   $update_sql .= ' order by '.$this->query_list['order'];
  if(isset($this->query_list['limit']))
   $update_sql .= ' '.$this->query_list['limit'];
  
  return $this->execute($update_sql);
  
 }
  /**
+------------------------------------------------ ----------
* クエリを実行してデータセットを返します
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param string $sql SQLコマンド
​​*/
    パブリック関数クエリ($sql) {
        if ( !$this->conn ) が false を返す;
        $this->queryStr = $sql;
        //释放前回の查询結果
        if ( $this->queryID ) { $this->free();    }
       
        $this->query_start_time = microtime(true);
       
        $this->queryID = mysql_query($sql, $this->conn);
        $this->query_count++;
        if ( false === $this->クエリID ) {
            $this->error();
            false を返します;
        } その他 {
            $this->numRows = mysql_num_rows($this->クエリID);
            $this->getAll();
を返す         }
    }
 /**
+------------------------------------------------ ----------
* ステートメントを実行します
+------------------------------------------------ ----------
* @アクセス公開
+------------------------------------------------ ----------
* @param string $sql SQLコマンド
+------------------------------------------------ ----------
​​*/
    パブリック関数実行($sql) {
        if ( !$this->conn ) が false を返す;
        $this->queryStr = $sql;
        //释放前回の查询結果
        if ( $this->queryID ) { $this->free();    }
       
        $this->query_start_time = microtime(true);
       
        $result = mysql_query($sql, $this->conn) ;
        $this->query_count++;
        if ( false === $result) {
            $this->error();
            false を返します;
        } その他 {
            $this->numRows = mysql_affected_rows($this->conn);
            $this->numRows を返す;
        }
    }
 /**
+------------------------------------------------ ----------
* すべてのクエリデータを取得します
+------------------------------------------------ ----------
* @アクセス非公開
+------------------------------------------------ ----------
* @return 配列
​​*/
    プライベート関数 getAll() {
        // 返される回数データ集
        $result = array();
        if($this->numRows &g

このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

Ubuntu および Debian 用の PHP 8.4 インストールおよびアップグレード ガイド Ubuntu および Debian 用の PHP 8.4 インストールおよびアップグレード ガイド Dec 24, 2024 pm 04:42 PM

PHP 8.4 では、いくつかの新機能、セキュリティの改善、パフォーマンスの改善が行われ、かなりの量の機能の非推奨と削除が行われています。 このガイドでは、Ubuntu、Debian、またはその派生版に PHP 8.4 をインストールする方法、または PHP 8.4 にアップグレードする方法について説明します。

CakePHP の日付と時刻 CakePHP の日付と時刻 Sep 10, 2024 pm 05:27 PM

Cakephp4 で日付と時刻を操作するには、利用可能な FrozenTime クラスを利用します。

CakePHP について話し合う CakePHP について話し合う Sep 10, 2024 pm 05:28 PM

CakePHP は、PHP 用のオープンソース フレームワークです。これは、アプリケーションの開発、展開、保守をより簡単にすることを目的としています。 CakePHP は、強力かつ理解しやすい MVC のようなアーキテクチャに基づいています。モデル、ビュー、コントローラー

CakePHP ファイルのアップロード CakePHP ファイルのアップロード Sep 10, 2024 pm 05:27 PM

ファイルのアップロードを行うには、フォーム ヘルパーを使用します。ここではファイルアップロードの例を示します。

CakePHP バリデータの作成 CakePHP バリデータの作成 Sep 10, 2024 pm 05:26 PM

Validator は、コントローラーに次の 2 行を追加することで作成できます。

CakePHP のロギング CakePHP のロギング Sep 10, 2024 pm 05:26 PM

CakePHP へのログインは非常に簡単な作業です。使用する関数は 1 つだけです。 cronjob などのバックグラウンド プロセスのエラー、例外、ユーザー アクティビティ、ユーザーが実行したアクションをログに記録できます。 CakePHP でのデータのログ記録は簡単です。 log()関数が提供されています

PHP 開発用に Visual Studio Code (VS Code) をセットアップする方法 PHP 開発用に Visual Studio Code (VS Code) をセットアップする方法 Dec 20, 2024 am 11:31 AM

Visual Studio Code (VS Code とも呼ばれる) は、すべての主要なオペレーティング システムで利用できる無料のソース コード エディター (統合開発環境 (IDE)) です。 多くのプログラミング言語の拡張機能の大規模なコレクションを備えた VS Code は、

CakePHP クイックガイド CakePHP クイックガイド Sep 10, 2024 pm 05:27 PM

CakePHP はオープンソースの MVC フレームワークです。これにより、アプリケーションの開発、展開、保守がはるかに簡単になります。 CakePHP には、最も一般的なタスクの過負荷を軽減するためのライブラリが多数あります。

See all articles