mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
self enable
This commit is contained in:
@@ -176,6 +176,22 @@ final class Nexus
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isAjax(): bool
|
||||
{
|
||||
if ($this->getScript() == 'ajax') {
|
||||
return true;
|
||||
}
|
||||
$ajax = $this->retrieveFromServer(['HTTP_X_REQUESTED_WITH'], true);
|
||||
if (!empty($ajax) && strtolower($ajax) == 'xmlhttprequest') {
|
||||
return true;
|
||||
}
|
||||
$json = $this->retrieveFromServer(['HTTP_ACCEPT'], true);
|
||||
if (!empty($json) && strtolower($json) == 'application/json') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function generateRequestId(): string
|
||||
{
|
||||
$prefix = ($_SERVER['SCRIPT_FILENAME'] ?? '') . implode('', $_SERVER['argv'] ?? []);
|
||||
@@ -426,4 +442,6 @@ final class Nexus
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user