I had tried to check the server name protocol using php ternary operator ?
Here is example and code:
Example: https://9.218.145.189
example code:
<a href="<?php echo $SERVER['SERVER_NAME']=($_SERVER['SERVER_NAME'])?($_SERVER['SERVER_NAME']=='ON'):($_SERVER['SERVER_NAME']=='OFF');?>">Click here</a>
QUery:
Error:
THe above code for a href link is not taking me to the https link.
FYI:
=
is assignment operator
==
is comparision operator
Hence try the following code(modified):
<a href="<?php echo $SERVER['SERVER_NAME']=($_SERVER['SERVER_NAME'])?($_SERVER['SERVER_NAME']='ON'):($_SERVER['SERVER_NAME']='OFF'); ?>">Click here</a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.