小编Aqe*_*mad的帖子

基于引用HTTP_REFERER htaccess重定向

我有一个问题,我想根据来自referered url的子字符串重定向用户,如何使用htaccess实现这一点?

  1. 用户在http://example.com/aqeel/videos/
  2. 上面的页面上有一个超链接http://demo.example.com/
  3. 当用户访问http://demo.example.com/时,我希望他被重定向到http://demo.example.com/login/aqeel/,这里aqeel是从步骤htaccess中的referer url捕获的子字符串1个URL.

提前致谢,

.htaccess http-referer

5
推荐指数
1
解决办法
4221
查看次数

如何在PHP中将对象转换为关联数组?

正如标题所示,我的问题是我如何将php类转换为关联数组?比如我

class MyObject {
  private $size = null;
  private $length = null;
  private $width = null;

    public function getSize(){
        return $this->size;
    }

    public function setSize($size){
        $this->size = $size;
    }

    public function getLength(){
        return $this->length;
    }

    public function setLength($length){
        $this->length = $length;
    }

    public function getWidth(){
        return $this->width;
    }

    public function setWidth($width){
        $this->width = $width;
    }

}

//Now what i want is following

$abc = new MyObject();
$abc->width = 10;
$anArray = someFunction($abc);  
//This should generate an associative array
//Now associative …
Run Code Online (Sandbox Code Playgroud)

php

2
推荐指数
1
解决办法
2480
查看次数

标签 统计

.htaccess ×1

http-referer ×1

php ×1