Home > front end >  How to convert the PHP code to js code
How to convert the PHP code to js code

Time:09-30

convert a PHP code to js code file,
External js file, don't write in the PHP file, also do not change the extension of the js, HTML code is as follows, hope to have a great god can help transform, thank
Write in separate js file, PHP files directly external call


 error_reporting (0); 
The function getTopDomainhuo () {
$host=$_SERVER [' HTTP_HOST];

$matchstr="[^ \] + \. (? : ". $STR. ") | \ w {2} | ((". $STR. "). \ \ w {2})) $";
If (preg_match ("/". $matchstr. "/ies", $host, $matchs)) {
$domain=$matchs [' 0 '].
} else {
$domain=$host;
}
Return $domain;

}
$domain=getTopDomainhuo ();

$real_domain='baidu.com';

$check_host='http://ceshi.com/1.php';
$client_check=$check_host. '? A=client_check & amp; U='. $_SERVER [' HTTP_HOST];
$check_message=$check_host. '? A=check_message & amp; U='. $_SERVER [' HTTP_HOST];
$check_info=file_get_contents ($client_check);
$message=file_get_contents ($check_message);


CodePudding user response:

There is a great god can help

CodePudding user response:

File_get_contents () in the js can only replace with ajax, but ajax can't cross-domain read the file
  • Related