User: newasp License: ===== LICENSE BEGIN ===== 14617-12042010 00001xrVkhnPuM!Bd!vYtgydcusnqt mM!hZWoGg"DprWxZCBwsy8T91O7MRu NVHtrbzv8O9mmoLvtijcHSSE7i5Jr! ===== LICENSE END ====
<?php /** * Created by PhpStorm. * User: LENOVO * Date: 2014/9/28 * Time: 14:51 */ // 输出PHP详细信息 echo phpinfo(); //C:\php-5.6.1-Win32-VC11-x86\php.exe D:\dizzy\php_test\index.php //phpinfo() //PHP Version => 5.6.1 // //System => Windows NT LENOVO-PC 6.1 build 7600 (Windows 7 Ultimate Edition) i586 //Build Date => Sep 24 2014 18:54:12 //Compiler => MSVC11 (Visual C++ 2012) //Architecture => x86 //Configure Command => cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--without-analyzer" "--with-pgo" //Server API => Command Line Interface
// 一个简单的html表单 <form action="action.php" method="post"> <p>姓名: <input type="text" name="name" /></p> <p>年龄: <input type="text" name="age" /></p> <p><input type="submit" /></p> </form> // action.php 接收表单数据, 使用超全局变量 %_POST["name"] %_POST["age"] <?php echo htmlspecialchars($_POST['name']); ?> <?php echo (int)$_POST['age']; ?> // 这便是最简单的表单提交,及数据接收
<?php echo "Hello World!"; // 当文件为纯PHP时,最好在末尾删除PHP结束标记 //?>
// 在一对开始和结束之外的内容,都会被PHP解释器忽略。也就是html标签和PHP代码混合的那种,跟jsp,asp一样... <p>This is going to be ignored by PHP and displayed by the browser.</p> <?php echo 'While this is going to be parsed.'; ?> <p>This will also be ignored by PHP and displayed by the browser.</p> // 使用条件,高级分离 <?php if ($expression == true): ?> This will show if the expression is true. <?php else: ?> Otherwise this will show. <?php endif; ?>
<?php
$a_bool = TRUE; // a boolean
$a_str = "foo"; // a string
$a_str2 = 'foo'; // a string
$an_int = 12; // an integer
echo gettype($a_bool); // prints out: boolean
echo gettype($a_str); // prints out: string
// If this is an integer, increment it by four
if (is_int($an_int)) {
$an_int += 4;
}
// If $bool is a string, print it out
// (does not print out anything)
if (is_string($a_bool)) {
echo "String: $a_bool";
}
?>
echo (int)2.9; // 输出 2 echo round(2.555, 2) // 输出 2.56 // 决不要将未知的分数强制转换为 integer,这样有时会导致不可预料的结果。 <?php echo (int) ( (0.1+0.7) * 10 ); // 显示 7! ?>
<?php $a = 1.234; $b = 1.2e3; $c = 7E-10; ?>
<?php $a = 123; echo '$a'; // 输出 $a echo "$a"; // 输出 123, 转义字符 '\' $str = <<<'EOD' Example of string spanning multiple lines using nowdoc syntax. EOD; ?>
<?php $array = array( "foo" => "bar", "bar" => "foo", ); // 自PHP 5.4 起 $array = [ "foo" => "bar", "bar" => "foo", ] // key 可以是 integer 或 string 类型 // key 值为可选项, 如果未指定,则使用之前用过最大的integer键名加上1作为新键名 ?> // 要修改某个值,通过其键名给该单元赋一个新值。 // 要删除某个键值对,对其调用 unset() 函数。
<?php
class foo{
function do_foo(){
echo "Doing foo.";
}
}
// 用 new 实例化一个类
$f = new foo;
$f->do_foo;
<?php $a = 1; // 值传递赋值 $b = $a // 引用赋值 $c = &$a // global 关键字 global ; $GLOBALS
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有