系统常量定义
echo ""."网站的根目录地址".__ROOT__." ";
echo ""."入口文件地址".__APP__." ";
echo ""."当前模块地址".__URL__." ";
echo ""."当前url地址".__SELF__." ";
echo ""."当前操作地址".__ACTION__." ";
echo ""."当前模块的模板目录".__CURRENT__." ";
echo ""."当前操作名称".ACTION_NAME." ";
echo ""."当前项目目录".APP_PATH." ";
echo ""."当前项目名称".APP_NAME." ";
echo ""."当前项目的模板目录".APP_TMPL_PATH." ";
echo ""."项目的公共文件目录".APP_PUBLIC_PATH." ";
echo ""."项目的配置文件目录".CONFIG_PATH." ";
echo ""."项目的公共文件目录".COMMON_PATH." ";//自动缓存与表相关的全部信息
echo ""."项目的数据文件目录".DATA_PATH." runtime下的data目录";
echo ""." ".GROUP_NAME."";
echo ""." ".IS_CGI."";echo "
echo ""." ".IS_WIN."";echo "
echo ""." ".LANG_SET."";echo "
echo ""." ".LOG_PATH."";echo "
echo ""." ".LANG_PATH."";echo "
echo ""." ".TMPL_PATH."";//js放入的位置,供多个应用的公共资源echo "
echo ""." ".WEB_PUBLIC_PATH."";
图片上传并生成缩略图【由于thinkphp没有自带生成缩略图需要自己写上传的类】
将下面两个文件放到Library/Think/下面
$upload=newUploadFile();//实例化上传类
$upload->maxSize=3145728;//设置附件上传大小
$upload->allowExts=array('jpg','gif','png','jpeg');//设置附件上传类型
$upload->allowTypes=array("image/jpg","image/gif","image/png","image/jpeg","image/jgpeg");//设置附件上传类型
$upload->saveName= time() . mt_rand();//文件的名称
$upload->savePath='Public/SameGo/images/li/blog/share/';//图片的保存目录
$upload->autoSub=false;
$upload->thumb=true;//设置需要生成缩略图,仅对图像文件有效
$upload->thumbPrefix='s_';//设置需要生成缩略图的文件后缀,支持多张 - "s_,m_"
// $upload->thumbPath = "Public/SameGo/images/li/blog/share/thumb/";//不生效
$upload->thumbMaxWidth='370';//设置缩略图最大宽度
$upload->thumbMaxHeight='250';//设置缩略图最大高度
$upload->thumbRemoveOrigin=false;//删除原图
$upload->saveRule=uniqid;//设置上传文件规则
//上传文件
if($upload->upload()) {//上传错误提示错误信息
$info=$upload->getUploadFileInfo();
echo $info[0]["savename"];//图片的名称
$data["image"] ='/helper/Public/SameGo/images/li/blog/share/'.$info[0]["savename"];//图片的路径
$data["thumb"] ='/helper/Public/SameGo/images/li/blog/share/'."s_".$info[0]["savename"];//缩略图的路径
}else{
echo"no";
}