PHP_MySQL

本文介绍PHP脚本的工作原理及其与Web服务器的关系,包括如何通过URL触发PHP脚本及使用GET和POST方法传递表单数据。同时,文中还详细讲解了如何利用PHP创建MySQL数据库和表格。
  1. PHP scripts run only after an event occurs.
  2. all PHP scripts must be accessed through a URL 
  3. .profile file(MAMP):
    export PATH=$PATH:/Applications/MAMP/Library/bin

    .profile file(manual):

    export: PATH=$PATH:/usr/local/mysql/bin
  4. the action attribute of a form: the value of it is the URL that will be loaded when the user clicks the Submit button. The data the user has typed in the form will be sent to this URL via the method specified in the method attribute, either get (appended to the end of the URL) or post (sent as a separate message). 
  5. The main reason for using a server-side scripting language is to be able to provide dynamic content to a site’s users. 
  6. One of the $_GET or $_POST arrays holds the details of all the form variables.Which array is used depends on whether the method used to submit the form was GET or POST, respectively. In addition, a combination of all data submitted via GET or POST is also available through $_REQUEST. 
  7. PHP scripts must always be "opened" through a URL from a web server.
  8. Concatenation involves sticking more than one string together to form a completely new string. concatenation always results in a string.
  9. characters in PHP are escaped with a "/".
  10. PHP handles strings differently depending on whether they’re enclosed by single or double quotes. Newline characters (\n) can only be escaped in double-quoted strings. Single-quoted strings are considered raw text, whereas PHP processes double-quoted strings looking for variables. When a variable is encountered within a double-quoted string, PHP inserts its value into the string as if the strings had been concatenated. So not only is a double-quoted string necessary to make the newlines work in the email message, but it also allows us to simplify the code by sticking the variables directly in the string. Single-quoted strings only allow the \' and \\ escape characters—all other escape characters can only be used in double- quoted strings. 
  11. PHP built-in mail() function: 
    // sytax: mail(to, subject, message [, headers [, parameters]])
    <?php
    $to = "someone@example.com";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $from = "someonelse@example.com";
    $headers = "From:" . $from;
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
    ?>
  12. MySQL create databases and tables:
    CREATE DATABASE aliendatabase;
    USE aliendatabase;
    CREATE TABLE sometable (
        first_name varchar(30),
        last_name varchar(30)
    );
  13. Check MySQL server:
    //; /usr/bin 
    mysqladmin --version
  14. MySQL ships with a blank password for the root MySQL user. 
  15. n
  16. n
  17. n
  18. n
  19. n
  20. n
  21. n

转载于:https://www.cnblogs.com/wade-case/p/3190805.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值