php的数据操作ui
<?php
error_reporting(0);//7all,0no
ini_set('display_errors', '0');
function myerror($errno, $errstr, $errfile, $errline)
{
echo "<BR>error type: [$errno] $errstr<br />\n";
echo "in line $errline of file $errfile<BR>";
}
set_error_handler("myerror");
include("config.php");
$link = mysql_connect($dbhost,$dbuser,$dbpass)
or die("Could not connect : " . mysql_error());
mysql_select_db($dbname) or die("Could not select database");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
//增加人名 insert into `address2` (`sname`) values('人名')
//修改 update `address2` set `sname`='人名' where id='23'
//查询所有的表名 SHOW TABLES from u656b1_db
<form action="" method="post">
<textarea name="how" style="width:100%; height:100px;" onkeypress="if(event.keyCode == 10)submit.click();">
<?PHP
if (isset($_REQUEST["how"]))
{
echo $_REQUEST["how"];
}
?>
</textarea><br>
<input name=ip value="<?PHP
if (isset($_REQUEST["ip"]))
{
echo $_REQUEST["ip"];
}
?>">
<input type="submit" id="submit" value="提交">
</form>
<?php
function runsql()
{
if ($_POST["ip"] != "password")
{
echo '密码不正确.';
return(0);
}
$sql = $_POST["how"];
if ( $sql == "")
&
相关文档:
进行文件的读和写,先打开一个文件,然后开始读或者写文件,最后再关系这个文件资源。
如,文件的读操作:
<?php
$file = fopen('your file path','r');
while(!feof($file)){ //当没有读取到文件结尾,继续循环读取操作
$line = fgets($file); //读取到一行的内容
echo $line.'<br/>';
}
fclose($file) ......
<?php
date_default_timezone_set("Etc/GMT-8");
header("content-type:text/html; charset=utf-8");
/**
* 自己定义的一个生成日历的类
* @author 张伟灿<yuanfen860913@163.com>
* @version 1.0.0
*
*/
class myCalendar
{
......
一、PHP函数Date()获取当前时间
代码:
<?php echo $showtime=date("Y-m-d H:i:s");?>
显示的格式: 年-月-日 小时:分钟:秒
相关参数:
a:"am"或者"pm"
A:"AM"或者"PM"
d:几日,二位数字,若不足二位则前面补零,如: "01"至"31"
D:星期几,三个英文字母,如: "Fri"
F:月份,英文全名,如: "Jan ......
php中substr的用法详解
php.net中关于substr的说明很简单:
start
If start is non-negative, the returned string will start at the start 'th position in string , counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so for ......
首先来个 email.class.php 类:
<?php
class smtp
{
/* Public Variables */
var $smtp_port;
var $time_out;
var $host_name;
var $log_file;
var $relay_host;
var $debug;
var $auth;
var $user;
var $pass;
/* Private Variables */
var $sock;
/* Constractor */
function smtp($rel ......