U E D R , A S I H C RSS

이승한/PHP

한 /PHP

: PHP



1.1.


  • include "./input.inc"; // 헤 통 inc . .

1.2. SQL API

  • 한 SQL 함 .
  • asp.net ODBC 한 DB .

1.2.1. DB


  • ~cpp   
    $dbconn = mysql_connect("<>", "<>", "<호>");
    $is_connect = mysql_select_db("<DB파 >", <mysql_connect , DB>);
    //  
    if(<mysql_select_db   true,  false>){
    	echo("MySql   패하.");
    } else{
    	echo("connected<br>");
    }
     
  • 1.2.2. query


    ~cpp 
    $query = "select name, eng, math from score";//  .
    $result = mysql_query($query, $dbconn); //<> = mysql_query(< >, <DB>); // 2  .
    $totalRecord = mysql_num_rows($result); //<> = mysql_num_rows(<>); //    
    
    if( $totalRecord == 0 ){
    	echo( "  .");
    }else{
    	echo("<tr><td>호</td><td></td><td></td><td>학</td>");
    	for($i =0; $i< $totalRecord; $i++){
    		$name = mysql_result($result, $i, 0);
    		$eng  = mysql_result($result, $i, 1);
    		$math = mysql_result($result, $i, 2);
    		$no = $i + 1;
    		echo("<tr><td>$no</td>");
    		echo("<td>$name</td>");
    		echo("<td>$eng</td>");
    		echo("<td>$math</td></tr>");
    	}
    }
    

    1.3.

    1.3.1.

    ??

    1.3.2.

    • getenv() //환.
      • REMOTE_ADDR: IP
      • HTTP_USER_AGENT :
    • flush() // // .
    • sleep() //windows sleep .
    • exit() // exit()

    1.3.3.

    • time() : 1970 1 1 0 0 0 합.
    • date() : date("y/m/d A h:i:s", time() );

    1.3.4. string

    PHP . // .
    • addslashes(); // . / .
    • strcmp($val1, $val2); // 1 0
    • htmlspecilchars(); //& " ' < > HTML . ex>& -> & " ->"
    • nl2br() // n <br> .
    • explode() // 형태 . array .
    • implode() //explode

      ~cpp 
      //explode
      $array_string = explode(" ", $string);
      //implode
      $array_string = array("Apple", "Orange", "Banana", "Grape");
      $string = implode(" or ", $array_string);
        
    • substr($, , ) // . excel middle . substr($string, 0, 5);
    • strlen() //C .
    • str_replace("", "", $) // replace
    • ord() // ascii
    • chr() // ascii

    1.4.


      • <? ?> . (ASP <% %> 핑하 편하.)
    • ( ; ) .
    • : C
    • : echo(" <br>");

    1.4.1.

  • : $ . type .
  • : 0, 1, 2, 3
  • : global $;
  • : static $;
  • : .
    ~cpp 
      $first = "good";
      $$first = "morning";
      echo("$good");
       
  • 1.4.2. html / form


    ~cpp 
      <form method="post" action="process.php">
       <input type="text" name="animal">
      <input type="submit" value="확">
      </form>.
      

    1.4.3.

  • : + - * / % . ++ .
  • : === != < > <= >= and or xor ! && || C .
  • 1.4.4.

  • if, while, switch, for .
  • break, continue
  • 1.4.5.

    function 함(){ 함; return ;} // Function . return type .



    ... 5 php -_-;;;
    php ?
    ? -
    Valid XHTML 1.0! Valid CSS! powered by MoniWiki
    last modified 2021-02-07 05:30:31
    Processing time 0.0200 sec