Warning (2): Undefined array key "content" [APP/Controller/NewsController.php, line 3037]Code Context{
$content=$this->keylink($website_info[0]["content"],$keywords_fc,1); //$str 原始字符 $link,替换链接数组, 3替换次数
$website_info[0]["content"]=$content;
App\Controller\NewsController::view() - APP/Controller/NewsController.php, line 3037 Cake\Controller\Controller::invokeAction() - CORE/src/Controller/Controller.php, line 539 Cake\Controller\ControllerFactory::handle() - CORE/src/Controller/ControllerFactory.php, line 140 Cake\Controller\ControllerFactory::invoke() - CORE/src/Controller/ControllerFactory.php, line 115 Cake\Http\BaseApplication::handle() - CORE/src/Http/BaseApplication.php, line 317 Cake\Http\Runner::handle() - CORE/src/Http/Runner.php, line 77 Cake\Http\Middleware\CsrfProtectionMiddleware::process() - CORE/src/Http/Middleware/CsrfProtectionMiddleware.php, line 164 Cake\Http\Runner::handle() - CORE/src/Http/Runner.php, line 73 Cake\I18n\Middleware\LocaleSelectorMiddleware::process() - CORE/src/I18n/Middleware/LocaleSelectorMiddleware.php, line 61 Cake\Http\Runner::handle() - CORE/src/Http/Runner.php, line 73 Cake\Http\Middleware\BodyParserMiddleware::process() - CORE/src/Http/Middleware/BodyParserMiddleware.php, line 157 Cake\Http\Runner::handle() - CORE/src/Http/Runner.php, line 73 Cake\Routing\Middleware\RoutingMiddleware::process() - CORE/src/Routing/Middleware/RoutingMiddleware.php, line 161 Cake\Http\Runner::handle() - CORE/src/Http/Runner.php, line 73 Cake\Routing\Middleware\AssetMiddleware::process() - CORE/src/Routing/Middleware/AssetMiddleware.php, line 77 Cake\Http\Runner::handle() - CORE/src/Http/Runner.php, line 73 Cake\Error\Middleware\ErrorHandlerMiddleware::process() - CORE/src/Error/Middleware/ErrorHandlerMiddleware.php, line 126
foreach($linkMap as $row) |
|
{ |
|
$row1=str_replace("/","",$row[0]); |
|
//$row1=$row[0]; |
|
$str = preg_replace('/(<a.*?>\s*)('.$row1.')(\s*<\/a>)/sui', '${2}', $str); |
|
} |
|
$tmpKwds = array(); |
|
foreach($linkMap as $i=>$row) { |
|
list($kwd, $url) = $row; |
foreach($linkMap as $row) |
|
{ |
|
$row1=str_replace("/","",$row[0]); |
|
//$row1=$row[0]; |
|
$str = preg_replace('/(<a.*?>\s*)('.$row1.')(\s*<\/a>)/sui', '${2}', $str); |
|
} |
|
$tmpKwds = array(); |
|
foreach($linkMap as $i=>$row) { |
|
list($kwd, $url) = $row; |
} |
|
|
|
if (count($keywords_fc)!="0") |
|
{ |
|
$content=$this->keylink($website_info[0]["content"],$keywords_fc,1); //$str 原始字符 $link,替换链接数组, 3替换次数 |
|
$website_info[0]["content"]=$content; |
|
} |
|
//分词==================== |
|
|
* @throws \UnexpectedValueException If return value of action is not `null` or `ResponseInterface` instance. |
|
*/ |
|
public function invokeAction(Closure $action, array $args): void |
|
{ |
|
$result = $action(...$args); |
|
if ($result !== null && !$result instanceof ResponseInterface) { |
|
throw new UnexpectedValueException(sprintf( |
|
'Controller actions can only return ResponseInterface instance or null. ' |
|
. 'Got %s instead.', |
$args = $this->getActionArgs( |
|
$action, |
|
array_values((array)$controller->getRequest()->getParam('pass')) |
|
); |
|
$controller->invokeAction($action, $args); |
|
|
|
$result = $controller->shutdownProcess(); |
|
if ($result instanceof ResponseInterface) { |
|
return $result; |
|
|
return $runner->run($middlewareQueue, $controller->getRequest(), $this); |
|
} |
|
|
|
return $this->handle($controller->getRequest()); |
|
} |
|
|
|
/** |
|
* Invoke the action. |
} |
|
|
|
$controller = $this->controllerFactory->create($request); |
|
|
|
return $this->controllerFactory->invoke($controller); |
|
} |
|
} |
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
|
} |
|
|
|
$response = new Response([ |
|
'body' => 'Middleware queue was exhausted without returning a response ' |
if ($method === 'GET' && $cookieData === null) { |
|
$token = $this->createToken(); |
|
$request = $request->withAttribute('csrfToken', $this->saltToken($token)); |
|
/** @var mixed $response */ |
|
$response = $handler->handle($request); |
|
|
|
return $this->_addTokenCookie($token, $request, $response); |
|
} |
|
|
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
{ |
|
$locale = Locale::acceptFromHttp($request->getHeaderLine('Accept-Language')); |
|
if (!$locale) { |
|
return $handler->handle($request); |
|
} |
|
if ($this->locales !== ['*']) { |
|
$locale = Locale::lookup($this->locales, $locale, true); |
|
} |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
*/ |
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
{ |
|
if (!in_array($request->getMethod(), $this->methods, true)) { |
|
return $handler->handle($request); |
|
} |
|
[$type] = explode(';', $request->getHeaderLine('Content-Type')); |
|
$type = strtolower($type); |
|
if (!isset($this->parsers[$type])) { |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
); |
|
} |
|
$matching = Router::getRouteCollection()->getMiddleware($middleware); |
|
if (!$matching) { |
|
return $handler->handle($request); |
|
} |
|
|
|
$middleware = new MiddlewareQueue($matching); |
|
$runner = new Runner(); |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
} |
|
|
|
$assetFile = $this->_getAssetFile($url); |
|
if ($assetFile === null || !is_file($assetFile)) { |
|
return $handler->handle($request); |
|
} |
|
|
|
$file = new SplFileInfo($assetFile); |
|
$modifiedTime = $file->getMTime(); |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
*/ |
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
{ |
|
try { |
|
return $handler->handle($request); |
|
} catch (RedirectException $exception) { |
|
return $this->handleRedirect($exception); |
|
} catch (Throwable $exception) { |
|
return $this->handleException($exception, $request); |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
$this->queue = $queue; |
|
$this->queue->rewind(); |
|
$this->fallbackHandler = $fallbackHandler; |
|
|
|
return $this->handle($request); |
|
} |
|
|
|
/** |
|
* Handle incoming server request and return a response. |
} |
|
|
|
$this->dispatchEvent('Server.buildMiddleware', ['middleware' => $middleware]); |
|
|
|
$response = $this->runner->run($middleware, $request, $this->app); |
|
|
|
if ($request instanceof ServerRequest) { |
|
$request->getSession()->close(); |
|
} |
// Bind your application to the server. |
|
$server = new Server(new Application(dirname(__DIR__) . '/config')); |
|
|
|
// Run the request/response through the application and emit the response. |
|
$server->emit($server->run()); |
|
|
If you want to customize this error message, create templates/Error/error500.php