代码中有上面是一个按钮,点击判断用户是否已经登录,如果已是登录状态,就跳转到info.php页面显示用户信息,如果没有登录,就跳转到用户登录页面,现在我想请教一下,这个按钮触发是否能够做个标识,我在登录页面上判断,如果是从这个按钮点击触发的登录,输入完信息后就直接跳转到info.php来显示用户信息
毕竟登录页面,是一个公用的,有些时候登录,跳转的页面可能是首页或者其他页面,不是都跳转到info.php,所以想触发按钮时候,做个标识,可以传递给登录页面,告知登录页面这次触发用户登录后是要显示用户信息的
回复讨论(解决方案)
1.增加一个隐藏值 比如 登录时根据这个值来前往不同页面
2.获取前一个页面的URL 根据URL来区分
可以增加一个隐藏的input,附一个值value=“”,根据这个值通往不同页面
这个值怎么用?在登录侧怎么判断?能否简单代码示例一下?
期待高手解答
等待高手解答
记着有一个js 好像叫 history.go(-1)
!两天了 都不去尝试的么!
1.表单<form name="login">xxxxxx自由发挥<input type="hidden" name="Toinfo" value="1"/></form>2,登陆校验if(isset($_POST['Toinfo'])&&$_POST['Toinfo']==1){//do something}
好像有点不对,因为我是在按钮点击触发打开登录页面,那么
好像有点不对,因为我是在按钮点击触发打开登录页面,那么
是表单的一个隐藏域,只要写在表单内,不管放哪都一样。
但是我没使用表单,是在php的文件中,直接就加了一个按钮
也可以吧?
我是写一个php判断跳转的 你可以参考下
session_start();function check ($url,$bool) { if (!isset($url)) {$url="http://127.0.0.1/ec/mobile/user.html";} if (isset($_SESSION['name'])) { setcookie('name',$_SESSION['name'],time()+3600*24*7); if($bool){ Header("HTTP/1.1 301 Moved Permanently"); Header("Location: ".$url); } return true; } else { if($bool){ Header("HTTP/1.1 301 Moved Permanently"); Header("Location: http://127.0.0.1/ec/mobile/login.html"); } return false; } }
可以提交个当前页面的参数 登录后跳转到初始的页面

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

SublimeText3 Linux new version
SublimeText3 Linux latest version

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

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