dirname(__FILE__); //得到的是文件所在层目录名 注意:在 Windows 中,正斜线(/)和反斜线(/)都可以用作目录分隔符。在其它环境下是斜线(/)。 define('TIME', time());//定义常量 echo gmdate('D, d M Y H:i:s', TIME); //输出常量 require dirname(__F
dirname(__FILE__); //得到的是文件所在层目录名
注意:在 Windows 中,正斜线(/)和反斜线(/)都可以用作目录分隔符。在其它环境下是斜线(/)。
define('TIME', time());//定义常量
echo gmdate('D, d M Y H:i:s', TIME); //输出常量
require dirname(__FILE__).'/chen_class/mysqlconn.php'; //引用外部文件
@是在程序出现错误时,屏蔽错误信息,不把错误信息显示在页面上.
//输出本页编码为utf-8
header("content-type:text/html; charset=utf-8");
//三种取值方法
$_REQUEST[]
$_POST[]
$_GET[]
//定义类
class mysql_access
{
function conn()
{
$dbh = mysql_connect('110.110.110.36','root','111111');
mysql_select_db('1234',$dbh);
$query ="select * from phpcms_ask_actor;";
//mysql_query("SET CHARACTER_SET_RESULTS=UTF8'");
mysql_query("set names utf8;");
$res = mysql_query($query, $dbh);
mysql_query("INSERT INTO phpcms_ask_actor(typeid,grade,actor,MIN,MAX) VALUES(5,'陈建平','是一个大好人!',4,5);");
}
}
?>
//php连接mssql数据库
$dbhost="110.110.110.39";
$dbuser="sa";
$dbpwd="111111";
$my_conn=@mssql_connect($dbhost,$dbuser,$dbpwd) or die("数据库连接错误!");
mssql_select_db('pubs',$my_conn);
$sql=mssql_query(iconv('UTF-8',"gbk","insert into jobs(job_desc,min_lvl,max_lvl) values('陈建',34,45)")); //解决汉字输入问题
$result =@mssql_query($sql,$my_conn);
mssql_close($my_conn);
extract($_POST);
//相当于$username = $_POST['username'];
//$password = $_POST['password'];
//页面调用类
$mysql_access = new mysql_access;
$mysql_access->conn();
//字符串相加
$output = " "; //必须要空一格否则与其它字符串相加也为空。
$output=$output."daddd";
//剪除指定字符
trim($strings,",");
trim($strings) ; //参数2为空时默认去掉头尾空格,制表,换行,回车,空值。
//截取字符串
substr($str4,2,45); //第2个参数代表起始位置的索引值(从0开始,取值包括),第三个参数代表要取字符个数
//替换字符串
str_replace("aa","bb","chen aa aa",$i); //第一个参数old字符串,第二个参数新字符串,第三参数要编辑的字符串[,第四个参数指替换字符串的个数]
//数组
自动分配 ID 键:
$names = array("Peter","Quagmire","Joe");
//取值
$names[0]
//关联数组
$ages = array("Peter"=>32, "Quagmire"=>30, "Joe"=>34);
//取值
$ages['Peter']
array_keys($memberinfo);//取数组键值
//自动取出数组,并用第一个参数分隔开
implode(' ', $memberinfo)
//多维数组:
$families = array
(
"Griffin"=>array("Peter","Lois","Megan"),
"Quagmire"=>array("Glenn"),
"Brown"=>array("Cleveland","Loretta","Junior")
);
//取值
$families['Griffin'][2]

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
