• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.