幹! php 還真難學...
明明記得當初 RH9架站時. 有依鳥哥教學用過 phpinfo() 列出版本資訊, 為何自己怎試就不行(沒顯示任何文字)!?...
原來...
<?php //沒有寫 'php'. 不行!
phpinfo();
?>
<? php // '?' 和 'php' 間多空一格也不行!!
phpinfo();
?>
<?php //沒有寫 'php'. 不行!
phpinfo();
?>
<? php // '?' 和 'php' 間多空一格也不行!!
phpinfo();
?>
文件: menu1.html<head>
<meta charset="utf-8" />
<title>html菜單示例</title>
</head>
<a href="https://JimmyKenny.blogspot.com">蕃薯家的生活</a> |
<a href="https://50air.blogspot.com/">50新空域</a> |
<a href="https://sites.google.com/view/yellowcat">黃子貓工作室 (雲端主頁)</a> |
<a href="https://dyhms.blogspot.com/">黃子貓工作室 (部落格)</a>
文件: include1.php
<?php include("menu1.html"); ?>
<h1>這是主菜單(include)</h1>
文件: form1.html
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Get表單示例</title>
</head>
<body><form action="welcome.php" method="get">
用戶名: <input type="text" name="name"/>
<input type="submit" value="提交"/>
</form>
文件: welcome.php
<head>
<meta charset="utf-8" />
<title>歡迎</title>
</head>
<?php
$name=$_GET["name"]; //接收$name的內容
echo "歡迎您, $name";
?>
文件: form2.html
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>POST表單示例</title>
</head>
<body>
<form action="login.php" method="post">
用戶名:<input type="text" name="name"/>
密碼:<input type="password" name="password"/>
<input type="submit" value="登錄"/>
</form>
文件: login.php
<head>
<meta charset="utf-8" />
<title>登錄</title>
</head>
<?php
$name=$_POST["name"];
$password=$_POST["password"];
echo "歡迎: $name, 您密碼是: $password";
?>
<?php
define( "MESSAGE","Hello YiiBai PHP");
echo MESSAGE, "<br/>";
?>
<?php
define( "MESSAGE","Hello YiiBai PHP",true); //指定不分大小寫
echo MESSAGE,"<br/>";
echo message,"<br/>";
?>
<?phpecho "<h3>Example for __LINE__</h3>";
echo "You are at line number " . __LINE__ . "<br><br>";// print Your current line number i.e;3
echo "<h3>Example for __FILE__</h3>";
echo __FILE__ . "<br><br>";//print full path of file with .php extension
echo "<h3>Example for __DIR__</h3>";
echo __DIR__ . "<br><br>";//print full path of directory where script will be placed
echo dirname(__FILE__) . "<br><br>"; //its output is equivalent to above one.
echo "<h3>Example for __FUNCTION__</h3>";
//Using magic constant inside function.
function cash(){
echo 'the function name is '. __FUNCTION__ . "<br><br>";//the function name is cash.
}cash();//Using magic constant outside function gives the blank output.
function test_function(){
echo 'HYIIII';
}test_function();
echo __FUNCTION__ . "<br><br>";//gives the blank output.echo "<h3>Example for __CLASS__</h3>";
class abc
{
public function __construct() {
;
}function abc_method(){
echo __CLASS__ . "<br><br>";//print name of the class abc.
}
}
$t = new abc;
$t->abc_method();class first{
function test_first(){
echo __CLASS__;//will always print parent class which is first here.
}
}class second extends first
{
public function __construct() {
;
}
}
$t = new second;
$t->test_first();echo "<h3>Example for __TRAIT__</h3>";
trait created_trait{
function abc(){
echo __TRAIT__;//will print name of the trait created_trait
}
}class anew{
use created_trait;
}
$a = new anew;
$a->abc();
echo "<h3>Example for __METHOD__</h3>";class meth{
public function __construct() {
echo __METHOD__ . "<br><br>";//print meth::__construct
}
public function meth_fun(){
echo __METHOD__;//print meth::meth_fun
}
}
$a = new meth;
$a->meth_fun();echo "<h3>Example for __NAMESPACE__</h3>";
class name{
public function __construct() {
echo 'This line will be printed on calling namespace';
}
}
$clas_name= __NAMESPACE__ .'\name';
$a = new $clas_name;?>
color
」不同於」Color
「,」COLOR
「等。<head>
<meta charset="utf-8">
</head>
"<br/>"
<?php
$x = "abc";
$$x = 200;
echo $x."<br/>";
echo $$x."<br/>";
echo $abc;
?>
HTML 元素可以設置屬性
屬性可以在元素中添加附加信息
屬性一般描述於開始標籤
屬性總是以名稱/值對的形式出現,比如:name="value"。
雙引號是最常用的,不過使用單引號也沒有問題。提示: 在某些個別的情況下,比如屬性值本身就含有雙引號,那麼您必須使用單引號,例如:name='John "ShotGun" Nelson'屬性和屬性值對大小寫不敏感。不過,萬維網聯盟在其 HTML 4 推薦標準中推薦小寫的屬性/屬性值。而新版本的 (X)HTML 要求使用小寫屬性。
將 CentOS 7 網卡名稱修改, 用回 Eth0 的方法: 1) # vi /etc/sysconfig/grub 內容大概是這樣: GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release...