A summary of some points in the learning process of php

  • 2020-10-31 21:40:34
  • OfStack

1.php pass value to javascript
php way to pass values to javascript: need to be in < ?php ? > Put quotation marks around the label
document.getElementById("titor"+a+b).innerHTML=" < ? php echo "May 20, 2013 13:25:55"? > ";
Note: In fact, My original understanding is wrong, php is dynamic display language. In fact, it is inside echo to show the relevant text. Since the original text is not enclosed in quotation marks, it is natural to include quotation marks

2. Timestamp conversion
strtotime converts datetime in mysql to a timestamp;

3. Rounding off 5 for data
number_format($time*$deposit_money*0.05/365,2) holds two decimal places and is rounded by 4. echo sprintf("%.2f", $number); Don't round 4 to 5

1.GRANT and REVOKE commands:
Grant and ungrant permissions to mysql users in four levels of global-database table-column

2. Create indexes
You can make queries faster create index statements

3. Retrieve variables
$_POST $_GET $_REQUEST

4. heredoc syntax
echo < < < theEnd
line 1
line 2
line 2
theEnd
Everything in theEnd is treated as a string

Related articles: