php5.3 php5.4 php5.5 php5.6 php7 python2.7 python3 C# F# java1.7 java1.8 shell c语言 c++ nasm(汇编) go lua perl ruby nodejs Objective-C swift erlang rust R语言 scala haskell D语言 clojure groovy lisp ocaml CoffeeScript racket nim
index.php

<?php $aa=60; echo "<pre>"; echo 'hello '.'xxx'.$aa."\n"; echo date('Y-m-d H:i:s',time())."\n"; echo "PHP版本:".phpversion()."\n\n"; print_r("MYSQL_USER:".getenv('MYSQL_USER')."\r\n"); print_r("MYSQL_PASSWORD:".getenv('MYSQL_PASSWORD')."\r\n"); print_r("MYSQL_DATABASE:".getenv('MYSQL_DATABASE')."\r\n"); $config = [ 'dbname' => getenv('MYSQL_DATABASE'), 'username' => getenv('MYSQL_USER'), 'password' => getenv('MYSQL_PASSWORD'), ]; $pdo = new PDO( sprintf('mysql:host=mysql;dbname=%s;charset=utf8mb4', $config['dbname']), $config['username'], $config['password'] ); $pdo->query("delete from test;")->fetchAll(PDO::FETCH_ASSOC); $age=rand(10,100); $pdo->query("insert into test(FirstName,LastName,Age) values ('test1','test11',$age), ('test2','test22',55), ('test123123','test22',55) ;")->fetchAll(PDO::FETCH_ASSOC); $rows= $pdo->query('SELECT * from test')->fetchAll(PDO::FETCH_ASSOC); print_r($_GET); ?> <table border=1> <tr> <td>FirstName</td> <td>roLastName</td> <td>Age</td> </tr> <?php foreach($rows as $row):?> <tr> <td><?php echo $row['FirstName']?></td> <td><?php echo $row['LastName']?></td> <td><?php echo $row['Age']?></td> </tr> <?php endforeach;?> <table>