易截截图软件、单文件、免安装、纯绿色、仅160KB

[PHP]Smarty的使用

<?php
define('SMARTY_TMP_DIR','C:/php5/Smarty-2.6.13/');
define('SMARTY_DIR','C:/php5/Smarty-2.6.13/libs/'); //SMARTY_DIR ->smarty keyword,must be defined as libs dectory
require_once(SMARTY_DIR.'Smarty.class.php');
//建立一个smarty对象
$smarty = new Smarty;
$smarty->template_dir = SMARTY_TMP_DIR.'templates/';
$smarty->compile_dir = SMARTY_TMP_DIR.'templates_c/';
$smarty->config_dir = SMARTY_TMP_DIR.'configs/';
$smarty->cache_dir = SMARTY_TMP_DIR.'cache/';
//$smarty->left_delimiter = '{/';
//$smarty->right_delimiter = '/}';
//----------simple show example------------
//$smarty->assign('name','Porky');
//$smarty->display('smarty_test.tpl');
?>


相关文档:

PHP 读取地址栏 参数


1.  $_GET

http://localhost/a.php?a=ok  
   
  <?  
  echo  
$_GET['a'];   //显示"ok"  
  ?>
2.  $_SERVER['QUERY_STRING']
http://localhost/a.php?a=1&b=2&c=3  
   
  ......

PHP 中获取文件名及路径


  为了脚本程序的兼容性,很多时候脚本的名称都不是固定的。所以我们需要通过动态获取当前脚本的路径、文件名来完成某些功能。
  PHP 中,我们可以使用常量 __FILE__ 来获取当前被执行脚本的完整路径。
  注意:当包含此变量的脚本被其他脚本include或者require的时候, __FILE__ 将仍然返回此脚本的地址,而不是 ......

PHP 中长连接的实现

  每次我们访问 PHP 脚本的时候,都是当所有的PHP脚本执行完成后,我们才得到返回结果。如果我们需要一个脚本持续的运行,那么我们就要通过 PHP 长连接的方式,来达到运行目的。
  每个 PHP 脚本都限制了执行时间,所以我们需要通过 set_time_limit 来设置一个脚本的执行时间为无限长;然后使用 flush() 和 ob_flush() ......

PHP用户登录注册模块实现


PHP用户登录模块实现
项目包含的功能脚本:
login.php//登录
reg.php//注册用户
user_add.php//注册校验脚本
user_login_check.php//登录校验脚本
image.php//验证码图片生成脚本
流程:
设计数据库:
包含用户uid,用户名,密码,昵称,性别,邮箱,注册时间
sql语句如下
create table users (uid bigint(20) ......

[PHP]PDO调用存储过程

1. 数据库中已创建存储过程user_logon_check, PHP调用示例如下,
<?php
$dsn = 'mssql:dbname=MyDbName;host=localhost';
$user = 'sa';
$password = '666666';
try {
$dbCon = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
print 'Connection failed: '.$e->getMessage();
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号