Welcome Guest, Not a member yet? Register   Sign In
Problem in Filter
#1

Ihave code in Filter like this
PHP Code:
<?php

namespace App\Filters\API;

use 
CodeIgniter\Filters\FilterInterface;
use 
CodeIgniter\HTTP\RequestInterface;
use 
CodeIgniter\HTTP\ResponseInterface;
use 
Config\Services;

class 
GuestRequest implements FilterInterface
{
 
   public function before(RequestInterface $request)
 
   {

 
        //$req  = ( $request->getMethod()=='post' && $request->isAJAX() == TRUE$
 
       $req $request->getMethod();
 
       $ajx $request->isAJAX();

 
       if$ajx == true )
 
       {
 
               Config('App')->data = (object)[$req$ajx];
 
               Config('App')->time microtime(true);
 
               return true;

 
       }


 
       return Services::response()
 
           ->setStatusCode(401);

 
   
In local (OS : linix mint, php 7.2) run normal
in VPS (OS Centos, php 7.2)
always return 401, although my codes change to
if( $ajx == false)
Reply
#2

I think you've already solved that. But if a Response instance is returned the request will be responded.
Reply
#3

Oh, it looks like you can not return anything not empty. Even then the code should not be executed... Have you found a solution?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB