我們再深入一點
做一個上載檔案的表單
<?php
if(!isset($_SESSION)) {session_start();}
require_once("設定.php");
$轉跳頁='tr.php';
$定義='按鈕info';
$定義類=$CSS類定義 ->轉譯機($定義);
$命名='按鈕';
$值='上載csv';
$檔案處裡->上載檔案($轉跳頁,$定義類,$命名,$值);
?>
function 上載檔案($轉跳頁,$定義類,$命名,$值)
{
echo '
<form method="post" enctype="multipart/form-data" action="'.$轉跳頁 .'">
<input class="'.$定義類.' " type="file" name="'.$命名.'">
<input class="'.$定義類.' " type="submit" value="'.$值.'">
</form>';
}
在这里插入代码片 網頁所呈現的  下圖是轉譯成html 方式
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="John.Hsieh">
<link rel=stylesheet type="text/css" href="my_css.css">
<link href="http://xxxxx/assets/css/john.css" rel="stylesheet">
<link href="http://xxxxx/assets/css/oneui.min.css" rel="stylesheet">
<script type="text/javascript" src="http://xxxxx/assets/js/oneui.core.min.js"></script>
<script type="text/javascript" src="http://xxxxx/assets/js/oneui.app.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="http://xxxxx/css/w3.css" rel="stylesheet">
<link href="http://xxxxx/css/bootstrap.css" rel="stylesheet">
<link href="http://xxxxx/css/bootstrap.min.css" rel="stylesheet">
<link href="http://xxxxx/css/bootstrap-grid.css" rel="stylesheet">
<link href="http://xxxxx/css/bootstrap-grid.min.css" rel="stylesheet">
<link href="http://xxxxx/css/bootstrap-reboot.css" rel="stylesheet">
<link href="http://xxxxx/css/bootstrap-reboot.min.css" rel="stylesheet">
<link href="http://xxxxx/css/normalize.css" rel="stylesheet">
<script type="text/javascript" src="http://xxxxx/js/bootstrap.bundle.js"></script>
<script type="text/javascript" src="http://xxxxx/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript" src="http://xxxxx/js/bootstrap.js"></script>
<script type="text/javascript" src="http://xxxxx/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://xxxxx/js/left-side-menu.js"></script>
<script type="text/javascript" src="http://xxxxx/js/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="http://xxxxx/js/jquery.sortable.js"></script>
<form method="post" enctype="multipart/form-data" action="tr.php">
<input class="btn btn-info " type="file" name="按鈕">
<input class="btn btn-info " type="submit" value="上載csv">
</form>
這樣的方式比較容易重複使用
|