[internal]
Arguments
AppServiceProvider {#98}
21
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php
);
}
}
/**
* Create a new PDO connection instance.
*
* @param string $dsn
* @param string $username
* @param string $password
* @param array $options
* @return \PDO
*/
protected function createPdoConnection($dsn, $username, $password, $options)
{
if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
return new PDOConnection($dsn, $username, $password, $options);
}
return new PDO($dsn, $username, $password, $options);
}
/**
* Determine if the connection is persistent.
*
* @param array $options
* @return bool
*/
protected function isPersistentConnection($options)
{
return isset($options[PDO::ATTR_PERSISTENT]) &&
$options[PDO::ATTR_PERSISTENT];
}
/**
* Handle an exception that occurred during connect execution.
*
* @param \Exception $e
* @param string $dsn
* @param string $username
Arguments
"PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known"
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php
);
}
}
/**
* Create a new PDO connection instance.
*
* @param string $dsn
* @param string $username
* @param string $password
* @param array $options
* @return \PDO
*/
protected function createPdoConnection($dsn, $username, $password, $options)
{
if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
return new PDOConnection($dsn, $username, $password, $options);
}
return new PDO($dsn, $username, $password, $options);
}
/**
* Determine if the connection is persistent.
*
* @param array $options
* @return bool
*/
protected function isPersistentConnection($options)
{
return isset($options[PDO::ATTR_PERSISTENT]) &&
$options[PDO::ATTR_PERSISTENT];
}
/**
* Handle an exception that occurred during connect execution.
*
* @param \Exception $e
* @param string $dsn
* @param string $username
Arguments
"mysql:host=rm-3nsmn73atb34ur8n5co.mysql.rds.aliyuncs.com;port=3306;dbname=seo"
"seo"
"seo123456dkjfs!@#"
array:5 [
8 => 0
3 => 2
11 => 0
17 => false
20 => false
]
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php
return isset($options[PDO::ATTR_PERSISTENT]) &&
$options[PDO::ATTR_PERSISTENT];
}
/**
* Handle an exception that occurred during connect execution.
*
* @param \Exception $e
* @param string $dsn
* @param string $username
* @param string $password
* @param array $options
* @return \PDO
*
* @throws \Exception
*/
protected function tryAgainIfCausedByLostConnection(Exception $e, $dsn, $username, $password, $options)
{
if ($this->causedByLostConnection($e)) {
return $this->createPdoConnection($dsn, $username, $password, $options);
}
throw $e;
}
/**
* Get the PDO options based on the configuration.
*
* @param array $config
* @return array
*/
public function getOptions(array $config)
{
$options = $config['options'] ?? [];
return array_diff_key($this->options, $options) + $options;
}
/**
* Get the default PDO connection options.
Arguments
"mysql:host=rm-3nsmn73atb34ur8n5co.mysql.rds.aliyuncs.com;port=3306;dbname=seo"
"seo"
"seo123456dkjfs!@#"
array:5 [
8 => 0
3 => 2
11 => 0
17 => false
20 => false
]
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php
* Create a new PDO connection.
*
* @param string $dsn
* @param array $config
* @param array $options
* @return \PDO
*/
public function createConnection($dsn, array $config, array $options)
{
list($username, $password) = [
$config['username'] ?? null, $config['password'] ?? null,
];
try {
return $this->createPdoConnection(
$dsn, $username, $password, $options
);
} catch (Exception $e) {
return $this->tryAgainIfCausedByLostConnection(
$e, $dsn, $username, $password, $options
);
}
}
/**
* Create a new PDO connection instance.
*
* @param string $dsn
* @param string $username
* @param string $password
* @param array $options
* @return \PDO
*/
protected function createPdoConnection($dsn, $username, $password, $options)
{
if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
return new PDOConnection($dsn, $username, $password, $options);
}
return new PDO($dsn, $username, $password, $options);
Arguments
PDOException {#194
#message: "SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known"
#code: 2002
#file: "/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php"
#line: 67
-previous: PDOException {#193
#message: "PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known"
#code: 0
#file: "/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php"
#line: 67
+errorInfo: null
+"severity": 2
}
+errorInfo: array:3 [
0 => "HY000"
1 => 2002
2 => "php_network_getaddresses: getaddrinfo failed: Name or service not known"
]
}
"mysql:host=rm-3nsmn73atb34ur8n5co.mysql.rds.aliyuncs.com;port=3306;dbname=seo"
"seo"
"seo123456dkjfs!@#"
array:5 [
8 => 0
3 => 2
11 => 0
17 => false
20 => false
]
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php
use PDO;
class MySqlConnector extends Connector implements ConnectorInterface
{
/**
* Establish a database connection.
*
* @param array $config
* @return \PDO
*/
public function connect(array $config)
{
$dsn = $this->getDsn($config);
$options = $this->getOptions($config);
// We need to grab the PDO options that should be used while making the brand
// new connection instance. The PDO options control various aspects of the
// connection's behavior, and some might be specified by the developers.
$connection = $this->createConnection($dsn, $config, $options);
if (! empty($config['database'])) {
$connection->exec("use `{$config['database']}`;");
}
$this->configureEncoding($connection, $config);
// Next, we will check to see if a timezone has been specified in this config
// and if it has we will issue a statement to modify the timezone with the
// database. Setting this DB timezone is an optional configuration item.
$this->configureTimezone($connection, $config);
$this->setModes($connection, $config);
return $connection;
}
/**
* Set the connection character set and collation.
*
Arguments
"mysql:host=rm-3nsmn73atb34ur8n5co.mysql.rds.aliyuncs.com;port=3306;dbname=seo"
array:12 [
"driver" => "mysql"
"host" => "rm-3nsmn73atb34ur8n5co.mysql.rds.aliyuncs.com"
"port" => "3306"
"database" => "seo"
"username" => "seo"
"password" => "seo123456dkjfs!@#"
"unix_socket" => ""
"charset" => "utf8mb4"
"collation" => "utf8mb4_unicode_ci"
"prefix" => "nm_"
"strict" => false
"name" => "mysql"
]
array:5 [
8 => 0
3 => 2
11 => 0
17 => false
20 => false
]
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php
{
return array_key_exists('host', $config)
? $this->createPdoResolverWithHosts($config)
: $this->createPdoResolverWithoutHosts($config);
}
/**
* Create a new Closure that resolves to a PDO instance with a specific host or an array of hosts.
*
* @param array $config
* @return \Closure
*/
protected function createPdoResolverWithHosts(array $config)
{
return function () use ($config) {
foreach (Arr::shuffle($hosts = $this->parseHosts($config)) as $key => $host) {
$config['host'] = $host;
try {
return $this->createConnector($config)->connect($config);
} catch (PDOException $e) {
if (count($hosts) - 1 === $key && $this->container->bound(ExceptionHandler::class)) {
$this->container->make(ExceptionHandler::class)->report($e);
}
}
}
throw $e;
};
}
/**
* Parse the hosts configuration item into an array.
*
* @param array $config
* @return array
*/
protected function parseHosts(array $config)
{
$hosts = Arr::wrap($config['host']);
Arguments
array:12 [
"driver" => "mysql"
"host" => "rm-3nsmn73atb34ur8n5co.mysql.rds.aliyuncs.com"
"port" => "3306"
"database" => "seo"
"username" => "seo"
"password" => "seo123456dkjfs!@#"
"unix_socket" => ""
"charset" => "utf8mb4"
"collation" => "utf8mb4_unicode_ci"
"prefix" => "nm_"
"strict" => false
"name" => "mysql"
]
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connection.php
$this->doctrineConnection = new DoctrineConnection([
'pdo' => $this->getPdo(),
'dbname' => $this->getConfig('database'),
'driver' => $driver->getName(),
], $driver);
}
return $this->doctrineConnection;
}
/**
* Get the current PDO connection.
*
* @return \PDO
*/
public function getPdo()
{
if ($this->pdo instanceof Closure) {
return $this->pdo = call_user_func($this->pdo);
}
return $this->pdo;
}
/**
* Get the current PDO connection used for reading.
*
* @return \PDO
*/
public function getReadPdo()
{
if ($this->transactions > 0) {
return $this->getPdo();
}
if ($this->getConfig('sticky') && $this->recordsModified) {
return $this->getPdo();
}
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connection.php
$this->doctrineConnection = new DoctrineConnection([
'pdo' => $this->getPdo(),
'dbname' => $this->getConfig('database'),
'driver' => $driver->getName(),
], $driver);
}
return $this->doctrineConnection;
}
/**
* Get the current PDO connection.
*
* @return \PDO
*/
public function getPdo()
{
if ($this->pdo instanceof Closure) {
return $this->pdo = call_user_func($this->pdo);
}
return $this->pdo;
}
/**
* Get the current PDO connection used for reading.
*
* @return \PDO
*/
public function getReadPdo()
{
if ($this->transactions > 0) {
return $this->getPdo();
}
if ($this->getConfig('sticky') && $this->recordsModified) {
return $this->getPdo();
}
Arguments
Closure {#187
class: "Illuminate\Database\Connectors\ConnectionFactory"
this: ConnectionFactory {#39 …}
use: {
$config: array:12 [
"driver" => "mysql"
"host" => "rm-3nsmn73atb34ur8n5co.mysql.rds.aliyuncs.com"
"port" => "3306"
"database" => "seo"
"username" => "seo"
"password" => "seo123456dkjfs!@#"
"unix_socket" => ""
"charset" => "utf8mb4"
"collation" => "utf8mb4_unicode_ci"
"prefix" => "nm_"
"strict" => false
"name" => "mysql"
]
}
}
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php
if (! isset($this->connections[$name])) {
return $this->connection($name);
}
return $this->refreshPdoConnections($name);
}
/**
* Refresh the PDO connections on a given connection.
*
* @param string $name
* @return \Illuminate\Database\Connection
*/
protected function refreshPdoConnections($name)
{
$fresh = $this->makeConnection($name);
return $this->connections[$name]
->setPdo($fresh->getPdo())
->setReadPdo($fresh->getReadPdo());
}
/**
* Get the default connection name.
*
* @return string
*/
public function getDefaultConnection()
{
return $this->app['config']['database.default'];
}
/**
* Set the default connection name.
*
* @param string $name
* @return void
*/
public function setDefaultConnection($name)
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php
if (isset($this->connections[$name = $name ?: $this->getDefaultConnection()])) {
$this->connections[$name]->disconnect();
}
}
/**
* Reconnect to the given database.
*
* @param string $name
* @return \Illuminate\Database\Connection
*/
public function reconnect($name = null)
{
$this->disconnect($name = $name ?: $this->getDefaultConnection());
if (! isset($this->connections[$name])) {
return $this->connection($name);
}
return $this->refreshPdoConnections($name);
}
/**
* Refresh the PDO connections on a given connection.
*
* @param string $name
* @return \Illuminate\Database\Connection
*/
protected function refreshPdoConnections($name)
{
$fresh = $this->makeConnection($name);
return $this->connections[$name]
->setPdo($fresh->getPdo())
->setReadPdo($fresh->getReadPdo());
}
/**
* Get the default connection name.
*
Arguments
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php
* @param \Illuminate\Database\Connection $connection
* @param string $type
* @return \Illuminate\Database\Connection
*/
protected function configure(Connection $connection, $type)
{
$connection = $this->setPdoForType($connection, $type);
// First we'll set the fetch mode and a few other dependencies of the database
// connection. This method basically just configures and prepares it to get
// used by the application. Once we're finished we'll return it back out.
if ($this->app->bound('events')) {
$connection->setEventDispatcher($this->app['events']);
}
// Here we'll set a reconnector callback. This reconnector can be any callable
// so we will set a Closure to reconnect from this manager with the name of
// the connection, which will allow us to reconnect from the connections.
$connection->setReconnector(function ($connection) {
$this->reconnect($connection->getName());
});
return $connection;
}
/**
* Prepare the read / write mode for database connection instance.
*
* @param \Illuminate\Database\Connection $connection
* @param string $type
* @return \Illuminate\Database\Connection
*/
protected function setPdoForType(Connection $connection, $type = null)
{
if ($type == 'read') {
$connection->setPdo($connection->getReadPdo());
} elseif ($type == 'write') {
$connection->setReadPdo($connection->getPdo());
}
Arguments
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connection.php
if ($this->causedByLostConnection($e->getPrevious())) {
$this->reconnect();
return $this->runQueryCallback($query, $bindings, $callback);
}
throw $e;
}
/**
* Reconnect to the database.
*
* @return void
*
* @throws \LogicException
*/
public function reconnect()
{
if (is_callable($this->reconnector)) {
return call_user_func($this->reconnector, $this);
}
throw new LogicException('Lost connection and no reconnector available.');
}
/**
* Reconnect to the database if a PDO connection is missing.
*
* @return void
*/
protected function reconnectIfMissingConnection()
{
if (is_null($this->pdo)) {
$this->reconnect();
}
}
/**
* Disconnect from the underlying PDO connection.
*
Arguments
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connection.php
if ($this->causedByLostConnection($e->getPrevious())) {
$this->reconnect();
return $this->runQueryCallback($query, $bindings, $callback);
}
throw $e;
}
/**
* Reconnect to the database.
*
* @return void
*
* @throws \LogicException
*/
public function reconnect()
{
if (is_callable($this->reconnector)) {
return call_user_func($this->reconnector, $this);
}
throw new LogicException('Lost connection and no reconnector available.');
}
/**
* Reconnect to the database if a PDO connection is missing.
*
* @return void
*/
protected function reconnectIfMissingConnection()
{
if (is_null($this->pdo)) {
$this->reconnect();
}
}
/**
* Disconnect from the underlying PDO connection.
*
Arguments
Closure {#158
class: "Illuminate\Database\DatabaseManager"
this: DatabaseManager {#21 …}
parameters: {
$connection: {}
}
}
MySqlConnection {#155}
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connection.php
return $this->tryAgainIfCausedByLostConnection(
$e, $query, $bindings, $callback
);
}
/**
* Handle a query exception that occurred during query execution.
*
* @param \Illuminate\Database\QueryException $e
* @param string $query
* @param array $bindings
* @param \Closure $callback
* @return mixed
*
* @throws \Illuminate\Database\QueryException
*/
protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback)
{
if ($this->causedByLostConnection($e->getPrevious())) {
$this->reconnect();
return $this->runQueryCallback($query, $bindings, $callback);
}
throw $e;
}
/**
* Reconnect to the database.
*
* @return void
*
* @throws \LogicException
*/
public function reconnect()
{
if (is_callable($this->reconnector)) {
return call_user_func($this->reconnector, $this);
}
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connection.php
}
/**
* Handle a query exception.
*
* @param \Exception $e
* @param string $query
* @param array $bindings
* @param \Closure $callback
* @return mixed
* @throws \Exception
*/
protected function handleQueryException($e, $query, $bindings, Closure $callback)
{
if ($this->transactions >= 1) {
throw $e;
}
return $this->tryAgainIfCausedByLostConnection(
$e, $query, $bindings, $callback
);
}
/**
* Handle a query exception that occurred during query execution.
*
* @param \Illuminate\Database\QueryException $e
* @param string $query
* @param array $bindings
* @param \Closure $callback
* @return mixed
*
* @throws \Illuminate\Database\QueryException
*/
protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback)
{
if ($this->causedByLostConnection($e->getPrevious())) {
$this->reconnect();
return $this->runQueryCallback($query, $bindings, $callback);
Arguments
QueryException {#186
#sql: "select * from `nm_site` where `domain` like ? or `mobile` like ? limit 1"
#bindings: array:2 [
0 => "%www.he-power.cn%"
1 => "%www.he-power.cn%"
]
#message: "SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (SQL: select * from `nm_site` where `domain` like %www.he-power.cn% or `mobile` like %www.he-power.cn% limit 1)"
#code: 2002
#file: "/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connection.php"
#line: 664
-previous: PDOException {#166
#message: "SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known"
#code: 2002
#file: "/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php"
#line: 67
-previous: PDOException {#165
#message: "PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known"
#code: 0
#file: "/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php"
#line: 67
+errorInfo: null
+"severity": 2
}
+errorInfo: array:3 [
0 => "HY000"
1 => 2002
2 => "php_network_getaddresses: getaddrinfo failed: Name or service not known"
]
}
+errorInfo: array:3 [
0 => "HY000"
1 => 2002
2 => "php_network_getaddresses: getaddrinfo failed: Name or service not known"
]
}
"select * from `nm_site` where `domain` like ? or `mobile` like ? limit 1"
array:2 [
0 => "%www.he-power.cn%"
1 => "%www.he-power.cn%"
]
Closure {#163
class: "Illuminate\Database\Connection"
this: MySqlConnection {#155 …}
parameters: {
$query: {}
$bindings: {}
}
use: {
$useReadPdo: true
}
}
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connection.php
* @param array $bindings
* @param \Closure $callback
* @return mixed
*
* @throws \Illuminate\Database\QueryException
*/
protected function run($query, $bindings, Closure $callback)
{
$this->reconnectIfMissingConnection();
$start = microtime(true);
// Here we will run this query. If an exception occurs we'll determine if it was
// caused by a connection that has been lost. If that is the cause, we'll try
// to re-establish connection and re-run the query with a fresh connection.
try {
$result = $this->runQueryCallback($query, $bindings, $callback);
} catch (QueryException $e) {
$result = $this->handleQueryException(
$e, $query, $bindings, $callback
);
}
// Once we have run the query we will calculate the time that it took to run and
// then log the query, bindings, and execution time so we will report them on
// the event that the developer needs them. We'll log time in milliseconds.
$this->logQuery(
$query, $bindings, $this->getElapsedTime($start)
);
return $result;
}
/**
* Run a SQL statement.
*
* @param string $query
* @param array $bindings
* @param \Closure $callback
* @return mixed
Arguments
QueryException {#186
#sql: "select * from `nm_site` where `domain` like ? or `mobile` like ? limit 1"
#bindings: array:2 [
0 => "%www.he-power.cn%"
1 => "%www.he-power.cn%"
]
#message: "SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (SQL: select * from `nm_site` where `domain` like %www.he-power.cn% or `mobile` like %www.he-power.cn% limit 1)"
#code: 2002
#file: "/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connection.php"
#line: 664
-previous: PDOException {#166
#message: "SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known"
#code: 2002
#file: "/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php"
#line: 67
-previous: PDOException {#165
#message: "PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known"
#code: 0
#file: "/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php"
#line: 67
+errorInfo: null
+"severity": 2
}
+errorInfo: array:3 [
0 => "HY000"
1 => 2002
2 => "php_network_getaddresses: getaddrinfo failed: Name or service not known"
]
}
+errorInfo: array:3 [
0 => "HY000"
1 => 2002
2 => "php_network_getaddresses: getaddrinfo failed: Name or service not known"
]
}
"select * from `nm_site` where `domain` like ? or `mobile` like ? limit 1"
array:2 [
0 => "%www.he-power.cn%"
1 => "%www.he-power.cn%"
]
Closure {#163
class: "Illuminate\Database\Connection"
this: MySqlConnection {#155 …}
parameters: {
$query: {}
$bindings: {}
}
use: {
$useReadPdo: true
}
}
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Connection.php
*/
public function select($query, $bindings = [], $useReadPdo = true)
{
return $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) {
if ($this->pretending()) {
return [];
}
// For select statements, we'll simply execute the query and return an array
// of the database result set. Each element in the array will be a single
// row from the database table, and will either be an array or objects.
$statement = $this->prepared($this->getPdoForSelect($useReadPdo)
->prepare($query));
$this->bindValues($statement, $this->prepareBindings($bindings));
$statement->execute();
return $statement->fetchAll();
});
}
/**
* Run a select statement against the database and returns a generator.
*
* @param string $query
* @param array $bindings
* @param bool $useReadPdo
* @return \Generator
*/
public function cursor($query, $bindings = [], $useReadPdo = true)
{
$statement = $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) {
if ($this->pretending()) {
return [];
}
// First we will create a statement for the query. Then, we will set the fetch
// mode and prepare the bindings for the query. Once that's done we will be
// ready to execute the query against the database and return the cursor.
Arguments
"select * from `nm_site` where `domain` like ? or `mobile` like ? limit 1"
array:2 [
0 => "%www.he-power.cn%"
1 => "%www.he-power.cn%"
]
Closure {#163
class: "Illuminate\Database\Connection"
this: MySqlConnection {#155 …}
parameters: {
$query: {}
$bindings: {}
}
use: {
$useReadPdo: true
}
}
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php
if (is_null($original)) {
$this->columns = $columns;
}
$results = $this->processor->processSelect($this, $this->runSelect());
$this->columns = $original;
return collect($results);
}
/**
* Run the query as a "select" statement against the connection.
*
* @return array
*/
protected function runSelect()
{
return $this->connection->select(
$this->toSql(), $this->getBindings(), ! $this->useWritePdo
);
}
/**
* Paginate the given query into a simple paginator.
*
* @param int $perPage
* @param array $columns
* @param string $pageName
* @param int|null $page
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null)
{
$page = $page ?: Paginator::resolveCurrentPage($pageName);
$total = $this->getCountForPagination($columns);
$results = $total ? $this->forPage($page, $perPage)->get($columns) : collect();
Arguments
"select * from `nm_site` where `domain` like ? or `mobile` like ? limit 1"
array:2 [
0 => "%www.he-power.cn%"
1 => "%www.he-power.cn%"
]
true
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php
$result = (array) $this->first([$column]);
return count($result) > 0 ? reset($result) : null;
}
/**
* Execute the query as a "select" statement.
*
* @param array $columns
* @return \Illuminate\Support\Collection
*/
public function get($columns = ['*'])
{
$original = $this->columns;
if (is_null($original)) {
$this->columns = $columns;
}
$results = $this->processor->processSelect($this, $this->runSelect());
$this->columns = $original;
return collect($results);
}
/**
* Run the query as a "select" statement against the connection.
*
* @return array
*/
protected function runSelect()
{
return $this->connection->select(
$this->toSql(), $this->getBindings(), ! $this->useWritePdo
);
}
/**
* Paginate the given query into a simple paginator.
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php
public function each(callable $callback, $count = 1000)
{
return $this->chunk($count, function ($results) use ($callback) {
foreach ($results as $key => $value) {
if ($callback($value, $key) === false) {
return false;
}
}
});
}
/**
* Execute the query and get the first result.
*
* @param array $columns
* @return \Illuminate\Database\Eloquent\Model|object|static|null
*/
public function first($columns = ['*'])
{
return $this->take(1)->get($columns)->first();
}
/**
* Apply the callback's query changes if the given "value" is true.
*
* @param mixed $value
* @param callable $callback
* @param callable $default
* @return mixed
*/
public function when($value, $callback, $default = null)
{
if ($value) {
return $callback($this, $value) ?: $this;
} elseif ($default) {
return $default($this, $value) ?: $this;
}
return $this;
}
Arguments
/www/wwwroot/wei/app/helpers.php
}
}
}
}
return $all;
}
}
// 获取site_id并按不同站点重新初始化配置信息,每次执行只获取一次所以用static
function get_site_id() {
static $get_site_id;
if ($get_site_id && !env('APP_DEBUG')) return $get_site_id;
if (!isset($_SERVER['HTTP_HOST'])) return 1;
$host = $_SERVER['HTTP_HOST'];
if (substr($host, 0, 1) == 't') $host = 'www'.substr($host, 1);
if (isset($_GET['site_id']))
$info = DB::table('site')->where('id', $_GET['site_id'])->first();
else
$info = DB::table('site')->where('domain', 'like', '%'.$host.'%')->orWhere('mobile', 'like', '%'.$host.'%')->first();
if ($info)
$get_site_id = $info->id;
else {
if (env('APP_DEBUG'))
dd($host);
else
$get_site_id = 1;
}
$file_path = $info->site_pre . $info->template;
config(['app.name' => $info->site_pre]);
$path = storage_path('framework/cache/data') . '/' . $file_path;
if (!is_dir($path)) mkdir($path);
config(['cache.stores.file.path' => $path]);
$path = storage_path('framework/sessions') . '/' . $file_path;
if (!is_dir($path)) mkdir($path);
config(['session.files' => $path]);
$path = realpath(storage_path('framework/views')) . '/' . $file_path;
if (!is_dir($path)) mkdir($path);
/www/wwwroot/wei/app/Providers/AppServiceProvider.php
use App\Models\ContNews;
use App\Repositoryes\CateNavRepository;
use Illuminate\Http\Request;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\DB;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot(Request $request)
{
// 为查询构建器注入自己实现的分页器方法
AcadePaginator::injectIntoBuilder();
$id = $request->input('sid');
$siteId = get_site_id();
$site_path = Db::table('site')->where('id', $siteId)->value('template');
$siteUrlKey = 1;
$sitemap = '/sitemaps/'.get_site_id().'/sitemap.xml';
// 指定站点隐藏首页资讯分类、足球/篮球下直播分类删除跳转,在当前页切换
$hideSiteIds = env('HIDE_CATE_ID');
$isHideSiteCate = (in_array($siteId, explode(',', $hideSiteIds))) ? 1 : 0;
//配置信息
$sysConfig = SysConfig::where('site_id', $siteId)->get()->pluck('value', 'name');
// 静态资源常量
$cdns = $sysConfig['cdn_web_name'] ?? '';
$fullUrl = $request->fullUrl();
$host = $request->getSchemeAndHttpHost();
if (!empty($cdns)) {
if (stripos($cdns, 'http') !== false || stripos($cdns, 'https')) {
$cdn = $cdns;
} else {
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php
class BoundMethod
{
/**
* Call the given Closure / class@method and inject its dependencies.
*
* @param \Illuminate\Container\Container $container
* @param callable|string $callback
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*/
public static function call($container, $callback, array $parameters = [], $defaultMethod = null)
{
if (static::isCallableWithAtSign($callback) || $defaultMethod) {
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return call_user_func_array(
$callback, static::getMethodDependencies($container, $callback, $parameters)
);
});
}
/**
* Call a string reference to a class using Class@method syntax.
*
* @param \Illuminate\Container\Container $container
* @param string $target
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*
* @throws \InvalidArgumentException
*/
protected static function callClass($container, $target, array $parameters = [], $defaultMethod = null)
{
$segments = explode('@', $target);
// We will assume an @ sign is used to delimit the class name from the method
Arguments
Request {#42
#json: null
#convertedFiles: null
#userResolver: null
#routeResolver: null
+attributes: ParameterBag {#44}
+request: ParameterBag {#50}
+query: ParameterBag {#50}
+server: ServerBag {#46}
+files: FileBag {#47}
+cookies: ParameterBag {#45}
+headers: HeaderBag {#48}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: array:1 [
0 => "*/*"
]
#pathInfo: null
#requestUri: null
#baseUrl: null
#basePath: null
#method: null
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
pathInfo: "/hedai-news/hedai-14588.html"
requestUri: "/hedai-news/hedai-14588.html"
baseUrl: ""
basePath: ""
method: "GET"
format: "html"
}
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php
class BoundMethod
{
/**
* Call the given Closure / class@method and inject its dependencies.
*
* @param \Illuminate\Container\Container $container
* @param callable|string $callback
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*/
public static function call($container, $callback, array $parameters = [], $defaultMethod = null)
{
if (static::isCallableWithAtSign($callback) || $defaultMethod) {
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return call_user_func_array(
$callback, static::getMethodDependencies($container, $callback, $parameters)
);
});
}
/**
* Call a string reference to a class using Class@method syntax.
*
* @param \Illuminate\Container\Container $container
* @param string $target
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*
* @throws \InvalidArgumentException
*/
protected static function callClass($container, $target, array $parameters = [], $defaultMethod = null)
{
$segments = explode('@', $target);
// We will assume an @ sign is used to delimit the class name from the method
Arguments
array:2 [
0 => AppServiceProvider {#98}
1 => "boot"
]
array:1 [
0 => Request {#42
#json: null
#convertedFiles: null
#userResolver: null
#routeResolver: null
+attributes: ParameterBag {#44}
+request: ParameterBag {#50}
+query: ParameterBag {#50}
+server: ServerBag {#46}
+files: FileBag {#47}
+cookies: ParameterBag {#45}
+headers: HeaderBag {#48}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: array:1 [
0 => "*/*"
]
#pathInfo: null
#requestUri: null
#baseUrl: null
#basePath: null
#method: null
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
pathInfo: "/hedai-news/hedai-14588.html"
requestUri: "/hedai-news/hedai-14588.html"
baseUrl: ""
basePath: ""
method: "GET"
format: "html"
}
]
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php
* @param callable $callback
* @param mixed $default
* @return mixed
*/
protected static function callBoundMethod($container, $callback, $default)
{
if (! is_array($callback)) {
return $default instanceof Closure ? $default() : $default;
}
// Here we need to turn the array callable into a Class@method string we can use to
// examine the container and see if there are any method bindings for this given
// method. If there are, we can call this method binding callback immediately.
$method = static::normalizeMethod($callback);
if ($container->hasMethodBinding($method)) {
return $container->callMethodBinding($method, $callback[0]);
}
return $default instanceof Closure ? $default() : $default;
}
/**
* Normalize the given callback into a Class@method string.
*
* @param callable $callback
* @return string
*/
protected static function normalizeMethod($callback)
{
$class = is_string($callback[0]) ? $callback[0] : get_class($callback[0]);
return "{$class}@{$callback[1]}";
}
/**
* Get all dependencies for a given method.
*
* @param \Illuminate\Container\Container $container
* @param callable|string $callback
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php
/**
* Call the given Closure / class@method and inject its dependencies.
*
* @param \Illuminate\Container\Container $container
* @param callable|string $callback
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*/
public static function call($container, $callback, array $parameters = [], $defaultMethod = null)
{
if (static::isCallableWithAtSign($callback) || $defaultMethod) {
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return call_user_func_array(
$callback, static::getMethodDependencies($container, $callback, $parameters)
);
});
}
/**
* Call a string reference to a class using Class@method syntax.
*
* @param \Illuminate\Container\Container $container
* @param string $target
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*
* @throws \InvalidArgumentException
*/
protected static function callClass($container, $target, array $parameters = [], $defaultMethod = null)
{
$segments = explode('@', $target);
// We will assume an @ sign is used to delimit the class name from the method
// name. We will split on this @ sign and then build a callable array that
// we can pass right back into the "call" method for dependency binding.
Arguments
Application {#2}
array:2 [
0 => AppServiceProvider {#98}
1 => "boot"
]
Closure {#31
class: "Illuminate\Container\BoundMethod"
use: {
$container: Application {#2 …}
$callback: array:2 [
0 => AppServiceProvider {#98}
1 => "boot"
]
$parameters: []
}
}
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Container/Container.php
* @return \Closure
*/
public function wrap(Closure $callback, array $parameters = [])
{
return function () use ($callback, $parameters) {
return $this->call($callback, $parameters);
};
}
/**
* Call the given Closure / class@method and inject its dependencies.
*
* @param callable|string $callback
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*/
public function call($callback, array $parameters = [], $defaultMethod = null)
{
return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
}
/**
* Get a closure to resolve the given type from the container.
*
* @param string $abstract
* @return \Closure
*/
public function factory($abstract)
{
return function () use ($abstract) {
return $this->make($abstract);
};
}
/**
* An alias function name for make().
*
* @param string $abstract
* @param array $parameters
Arguments
Application {#2}
array:2 [
0 => AppServiceProvider {#98}
1 => "boot"
]
[]
null
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
array_walk($this->serviceProviders, function ($p) {
$this->bootProvider($p);
});
$this->booted = true;
$this->fireAppCallbacks($this->bootedCallbacks);
}
/**
* Boot the given service provider.
*
* @param \Illuminate\Support\ServiceProvider $provider
* @return mixed
*/
protected function bootProvider(ServiceProvider $provider)
{
if (method_exists($provider, 'boot')) {
return $this->call([$provider, 'boot']);
}
}
/**
* Register a new boot listener.
*
* @param mixed $callback
* @return void
*/
public function booting($callback)
{
$this->bootingCallbacks[] = $callback;
}
/**
* Register a new "booted" listener.
*
* @param mixed $callback
* @return void
*/
Arguments
array:2 [
0 => AppServiceProvider {#98}
1 => "boot"
]
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
}
/**
* Boot the application's service providers.
*
* @return void
*/
public function boot()
{
if ($this->booted) {
return;
}
// Once the application has booted we will also fire some "booted" callbacks
// for any listeners that need to do work after this initial booting gets
// finished. This is useful when ordering the boot-up processes we run.
$this->fireAppCallbacks($this->bootingCallbacks);
array_walk($this->serviceProviders, function ($p) {
$this->bootProvider($p);
});
$this->booted = true;
$this->fireAppCallbacks($this->bootedCallbacks);
}
/**
* Boot the given service provider.
*
* @param \Illuminate\Support\ServiceProvider $provider
* @return mixed
*/
protected function bootProvider(ServiceProvider $provider)
{
if (method_exists($provider, 'boot')) {
return $this->call([$provider, 'boot']);
}
}
Arguments
[internal]
Arguments
AppServiceProvider {#98}
21
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
/**
* Boot the application's service providers.
*
* @return void
*/
public function boot()
{
if ($this->booted) {
return;
}
// Once the application has booted we will also fire some "booted" callbacks
// for any listeners that need to do work after this initial booting gets
// finished. This is useful when ordering the boot-up processes we run.
$this->fireAppCallbacks($this->bootingCallbacks);
array_walk($this->serviceProviders, function ($p) {
$this->bootProvider($p);
});
$this->booted = true;
$this->fireAppCallbacks($this->bootedCallbacks);
}
/**
* Boot the given service provider.
*
* @param \Illuminate\Support\ServiceProvider $provider
* @return mixed
*/
protected function bootProvider(ServiceProvider $provider)
{
if (method_exists($provider, 'boot')) {
return $this->call([$provider, 'boot']);
}
}
/**
Arguments
array:28 [
0 => EventServiceProvider {#6}
1 => LogServiceProvider {#8}
2 => RoutingServiceProvider {#10}
3 => AuthServiceProvider {#41}
4 => CookieServiceProvider {#37}
5 => DatabaseServiceProvider {#51}
6 => EncryptionServiceProvider {#58}
7 => FilesystemServiceProvider {#60}
8 => FormRequestServiceProvider {#66}
9 => FoundationServiceProvider {#65}
10 => NotificationServiceProvider {#68}
11 => PaginationServiceProvider {#70}
12 => SessionServiceProvider {#74}
13 => ViewServiceProvider {#78}
14 => ServiceProvider {#82}
15 => ZipperServiceProvider {#86}
16 => TrustedProxyServiceProvider {#89}
17 => ImageServiceProvider {#90}
18 => CaptchaServiceProvider {#93}
19 => ServiceProvider {#95}
20 => LaravelInstallerServiceProvider {#96}
21 => AppServiceProvider {#98}
22 => AuthServiceProvider {#113}
23 => EventServiceProvider {#114}
24 => RouteServiceProvider {#115}
25 => ValidationServiceProvider {#132}
26 => TranslationServiceProvider {#137}
27 => HashServiceProvider {#175}
]
Closure {#22
class: "Illuminate\Foundation\Application"
this: Application {#2 …}
parameters: {
$p: {}
}
}
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php
<?php
namespace Illuminate\Foundation\Bootstrap;
use Illuminate\Contracts\Foundation\Application;
class BootProviders
{
/**
* Bootstrap the given application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
public function bootstrap(Application $app)
{
$app->boot();
}
}
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
$this->register(new LogServiceProvider($this));
$this->register(new RoutingServiceProvider($this));
}
/**
* Run the given array of bootstrap classes.
*
* @param array $bootstrappers
* @return void
*/
public function bootstrapWith(array $bootstrappers)
{
$this->hasBeenBootstrapped = true;
foreach ($bootstrappers as $bootstrapper) {
$this['events']->fire('bootstrapping: '.$bootstrapper, [$this]);
$this->make($bootstrapper)->bootstrap($this);
$this['events']->fire('bootstrapped: '.$bootstrapper, [$this]);
}
}
/**
* Register a callback to run after loading the environment.
*
* @param \Closure $callback
* @return void
*/
public function afterLoadingEnvironment(Closure $callback)
{
return $this->afterBootstrapping(
LoadEnvironmentVariables::class, $callback
);
}
/**
* Register a callback to run before a bootstrapper.
Arguments
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php
Facade::clearResolvedInstance('request');
$this->bootstrap();
return (new Pipeline($this->app))
->send($request)
->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware)
->then($this->dispatchToRouter());
}
/**
* Bootstrap the application for HTTP requests.
*
* @return void
*/
public function bootstrap()
{
if (! $this->app->hasBeenBootstrapped()) {
$this->app->bootstrapWith($this->bootstrappers());
}
}
/**
* Get the route dispatcher callback.
*
* @return \Closure
*/
protected function dispatchToRouter()
{
return function ($request) {
$this->app->instance('request', $request);
return $this->router->dispatch($request);
};
}
/**
* Call the terminate method on any terminable middleware.
*
Arguments
array:6 [
0 => "Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables"
1 => "Illuminate\Foundation\Bootstrap\LoadConfiguration"
2 => "Illuminate\Foundation\Bootstrap\HandleExceptions"
3 => "Illuminate\Foundation\Bootstrap\RegisterFacades"
4 => "Illuminate\Foundation\Bootstrap\RegisterProviders"
5 => "Illuminate\Foundation\Bootstrap\BootProviders"
]
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php
$this->app['events']->dispatch(
new Events\RequestHandled($request, $response)
);
return $response;
}
/**
* Send the given request through the middleware / router.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
protected function sendRequestThroughRouter($request)
{
$this->app->instance('request', $request);
Facade::clearResolvedInstance('request');
$this->bootstrap();
return (new Pipeline($this->app))
->send($request)
->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware)
->then($this->dispatchToRouter());
}
/**
* Bootstrap the application for HTTP requests.
*
* @return void
*/
public function bootstrap()
{
if (! $this->app->hasBeenBootstrapped()) {
$this->app->bootstrapWith($this->bootstrappers());
}
}
/**
/www/wwwroot/wei/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php
$router->middlewareGroup($key, $middleware);
}
foreach ($this->routeMiddleware as $key => $middleware) {
$router->aliasMiddleware($key, $middleware);
}
}
/**
* Handle an incoming HTTP request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function handle($request)
{
try {
$request->enableHttpMethodParameterOverride();
$response = $this->sendRequestThroughRouter($request);
} catch (Exception $e) {
$this->reportException($e);
$response = $this->renderException($request, $e);
} catch (Throwable $e) {
$this->reportException($e = new FatalThrowableError($e));
$response = $this->renderException($request, $e);
}
$this->app['events']->dispatch(
new Events\RequestHandled($request, $response)
);
return $response;
}
/**
* Send the given request through the middleware / router.
*
Arguments
Request {#42
#json: null
#convertedFiles: null
#userResolver: null
#routeResolver: null
+attributes: ParameterBag {#44}
+request: ParameterBag {#50}
+query: ParameterBag {#50}
+server: ServerBag {#46}
+files: FileBag {#47}
+cookies: ParameterBag {#45}
+headers: HeaderBag {#48}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: array:1 [
0 => "*/*"
]
#pathInfo: null
#requestUri: null
#baseUrl: null
#basePath: null
#method: null
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
pathInfo: "/hedai-news/hedai-14588.html"
requestUri: "/hedai-news/hedai-14588.html"
baseUrl: ""
basePath: ""
method: "GET"
format: "html"
}
/www/wwwroot/wei/public/index.php
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
Arguments
Request {#42
#json: null
#convertedFiles: null
#userResolver: null
#routeResolver: null
+attributes: ParameterBag {#44}
+request: ParameterBag {#50}
+query: ParameterBag {#50}
+server: ServerBag {#46}
+files: FileBag {#47}
+cookies: ParameterBag {#45}
+headers: HeaderBag {#48}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: array:1 [
0 => "*/*"
]
#pathInfo: null
#requestUri: null
#baseUrl: null
#basePath: null
#method: null
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
pathInfo: "/hedai-news/hedai-14588.html"
requestUri: "/hedai-news/hedai-14588.html"
baseUrl: ""
basePath: ""
method: "GET"
format: "html"
}