search
HomeBackend DevelopmentPHP TutorialParse error: syntax error, unexpected 'include' (T_INCLUDE) in D:mywebadd.php解决方案

Parse error: syntax error, unexpected 'include' (T_INCLUDE) in D:\myweb\add.php
add.php的源代码:
//用户注册以后的数据处理文件.需要先检查数据合法性,然后写入数据库
//获取注册用户提交的数据
$UserName1=$_POST["UserName"];//用户名
$Password1=$_POST["Password"];//密码
$ConfirmPassword1=$_POST["ConfirmPassword"];//确认密码
$Email=$_POST["Email"];//邮箱
//定义保存激活码变量
$actnum=""
//导入数据库文件
include 'config.php';
//定义产生激活码函数
function Check_actnum()
{
$chars_for_actnum=array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9","0");
for($i=1;$i {
$actnum=$chars_for_actnum[mt_rand(0,count($chars_for_actnum)-1)];
}
return $actnum;
}
//判断用户名函数
function Check_UserName($UserName)//参数为用户注册的用户名
{
//用户名三个方面检查
//是否为空 字符串检测 长度检测
$Max_Strlen_UserName=16;//用户名最大长度
$Min_Strlen_UserName=4;//用户名最短长度
$UserNameChars="^[A-Za-z0-9_-]";//字符串检测的正则表达式
$UserNameGood="用户名检测正确";//定义返回的字符串变量
if($UserName=="")
{
$UserName="用户名不能为空";
return $UserNameGood;
}
if(!reg("$UserNameChars",$UserName))//正则表达式匹配检查
{
$UserNameGood="用户名字符串检测不正确";
return $UserNameGood;
}
if(strlen(UserName)$Max_Strlen_UserName)
{
$UserNameGood="用户名字长度检测不正确";
return $UserNameGood;
}
return $UserNameGood;
}
//判断密码是否合法函数
function Check_Password($Password)
{
//是否为空 字符串检测 长度检测
$Max_Strlen_Password=16;//密码最大长度
$Min_Strlen_Password=6;//密码最短长度
$PasswordChars="^[A-Za-z0-9_-]";//密码字符串检测正则表达式
$PasswordGood="密码检测正确";//定义返回的字符串变量
if($Password=="")
{
$PasswordGood="密码不能为空";
return $PasswordGood;
}
if(!ereg("$PasswordChars",$Password))
{
$PasswordGood="密码字符串检测不正确";
return $PasswordGood;
}
if(strlen($Password)$Max_Strlen_Password)
{
$PasswordGood="密码长度检测不正确";
return $PasswordGood;
}
return $PasswordGood;
}
//判断邮箱是否合法函数
function Check_Email($Email)
{
$EmailChars="^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*$";//正则表达式判断是否是合法邮箱地址
$EmailGood="邮箱检测正确";
if($Email=="")
{
$EmailGood="邮箱不能为空";
return $EmailGood;
}
return $EmailGood;
}
//判断两次密码输入是否一致
function Check_ConfirmPassword($Password,$ConfirmPassword)
{
$ConfirmPasswordGood="两次密码输入一致";
if($Password$ConfirmPassword)
{
$ConfirmPasswordGood="两次密码输入不一致";
return $ConfirmPasswordGood;
}
else
return $ConfirmPasswordGood;
}
//调用函数,检测用户输入数据
$UserNameGood=Check_UserName($UserName1);
$PasswordGood=Check_Password($Password1);
$EmailGood=Check_Email($Email);
$ConfirmPasswordGood=Check_ConfirmPassword($Password1,$ConfirmPassword1);
$error=false;//定义变量判断注册数据是否出现错误
if($UserNameGood!="用户名检测正确")

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP Performance Tuning for High Traffic WebsitesPHP Performance Tuning for High Traffic WebsitesMay 14, 2025 am 12:13 AM

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

Dependency Injection in PHP: Code Examples for BeginnersDependency Injection in PHP: Code Examples for BeginnersMay 14, 2025 am 12:08 AM

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

PHP Performance: is it possible to optimize the application?PHP Performance: is it possible to optimize the application?May 14, 2025 am 12:04 AM

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

PHP Performance Optimization: The Ultimate GuidePHP Performance Optimization: The Ultimate GuideMay 14, 2025 am 12:02 AM

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

PHP Dependency Injection Container: A Quick StartPHP Dependency Injection Container: A Quick StartMay 13, 2025 am 12:11 AM

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Dependency Injection vs. Service Locator in PHPDependency Injection vs. Service Locator in PHPMay 13, 2025 am 12:10 AM

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHP performance optimization strategies.PHP performance optimization strategies.May 13, 2025 am 12:06 AM

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHP Email Validation: Ensuring Emails Are Sent CorrectlyPHP Email Validation: Ensuring Emails Are Sent CorrectlyMay 13, 2025 am 12:06 AM

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

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

Atom editor mac version download

The most popular open source editor

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool