PHP做一个短信验证的,ajax提交过去之后没反应
//002.根据手机号反回验证码,function getnum(){ if($("#tel").val()=="" || $("#tel").val()==null){ // 手机号为空校验 alert('提示:请输入手机号'); }else{ // 提交数据 $.ajax({ type: "get", url: "http://www.diyiwuxian.com/tools/index.php?c=Phone&m=getactnum", async: true, dataType: "html", data: {tel:$("#tel").val()}, success: function(data) { // 返回-1.手机号格式 不对 if($.parseJSON(data).ret==-1){ $("#tel").focus(); $("#tel").val(""); alert('提示:请输入正确的手机号码!'); }else{ $("#num").val($.parseJSON(data).ret); } } }); }}
//接口参数$classCName = @$_GET['c']?$_GET['c']:'';$method = @$_GET['m']?$_GET['m']:'';$method = isset($method) ? $method : "index";if ( !$classCName || !$method ) { echo "controller or method is null"; exit(); }$classCName = $classCName."Controller";if(file_exists(HTDOC.'gmcontrollers/'.$classCName . ".php")) { require_once (HTDOC.'gmcontrollers/'.$classCName . ".php"); $objC = new $classCName; if(method_exists($classCName, $method)) return $objC -> $method(); else echo "class: {$classCName} not has method {$method}";} else { echo 'no file';}
回复讨论(解决方案)
这个调试很简单的
php 什么都注释掉,直接echo一个字符串,看有没有东西返回
看看firebug有什么提示。
是不是跨域了?
1.检查提交之后,firebug的console是否报错。
2.提交的时候,追踪下url路径,看返回值是什么?
用firebug 等工具抓包看看,有什么返回
找到原因, 一个文件打不开
1.检查提交之后,firebug的console是否报错。
2.提交的时候,追踪下url路径,看返回值是什么?
Warning: include() [function.include]: Failed opening '/data/webserver/sites/diyiwuxian/lib/Auth.php' for inclusion (include_path='.:/data/webserver/php/lib/php') in /data/webserver/sites/ht/include/inc.php on line 16
文件问题,这是怎么回事?
文件 /data/webserver/sites/diyiwuxian/lib/Auth.php 不存在
请注意大小写

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

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.

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

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

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

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.

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

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


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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

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

WebStorm Mac version
Useful JavaScript development tools
