热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

ZendFramework动作助手Redirector用法实例详解_PHP-php教程

这篇文章主要介绍了ZendFramework动作助手Redirector用法,结合实例形式详细分析了转向器Redirector的功能,使用方法与相关注意事项,需要的朋友可以参考下
本文实例讲述了Zend Framework动作助手Redirector用法。分享给大家供大家参考,具体如下:

Redirector 提供另一种实现方式,帮助程序重定向到内部或者外部页面;

转向器(Redirector)助手让你使用一个转向器对象帮助程序重定向到新的URL。与_redirect()方法相比,它具有多项优势。例如能够在转向器对象中预先配置整个站点的行为,或者使用与Zend_Controller_Action::_forward()相似的gotoSimple($action, $controller, $module, $params)接口。

转向器拥有影响重定向行为的大量方法:

setCode() 设置重定向过程中使用的HTTP响应码。

setExit() 在重定向后强制执行exit()方法。默认已设定。

setGotoSimple()设置默认的URL,当没有提供参数给gotoSimple()方法时转向该URL。可以使用类似Zend_Controller_Action::_forward()的API:setGotoSimple($action, $cOntroller= null, $module = null, array $params = array());

setGotoRoute()设置基于一个注册路由器的URL。通过传入一个键/值数组和一个路由器名,它将根据路由器的类型和定义来组织URL。

setGotoUrl()设置默认的URL,当没有参数传入gotoUrl(),将使用该URL。接受单个URL字符串。

setPrependBase()在setGotoUrl()、gotoUrl()或者gotoUrlAndExit()指定的URL前面,加入请求对象的基地址(base URL)。

setUseAbsoluteUri()强制转向器在重定向时使用绝对的URI。当该选项设定后,将使用$_SERVER['HTTP_HOST']、 $_SERVER['SERVER_PORT']和 $_SERVER['HTTPS']以及重定向方法指定的URL,来形成一个完整的URI。该选项目前默认关闭,将来的版本可能会默认开启。

此外,转向器中还有大量方法来执行实际的重定向

gotoSimple()使用setGotoSimple()(类似_forward()的API)来构建URL并执行重定向。

gotoRoute()使用setGotoRoute()(路由组装route-assembly)来构建URL并执行重定向。

gotoUrl()使用setGotoUrl() URL字符串)来构造URL并执行重定向。
最后,你可以在任何时刻使用getRedirectUrl()确定当前的重定向URL。

基础用例

Example #5 设定选项

这个例子改变了几个选项,包括设定重定向时使用的HTTP状态码为303,重定向时不默认退出,以及定义了默认的URL供重定向使用。

class SomeController extends Zend_Controller_Action
{
  /**
   * Redirector - defined for code completion
   *
   * @var Zend_Controller_Action_Helper_Redirector
   */
  protected $_redirector = null;
  public function init()
  {
    $this->_redirector = $this->_helper->getHelper('Redirector');
    // Set the default options for the redirector
    // Since the object is registered in the helper broker, these
    // become relevant for all actions from this point forward
    $this->_redirector->setCode(303)
             ->setExit(false)
             ->setGotoSimple("this-action",
                     "some-controller");
  }
  public function myAction()
  {
    /* do some stuff */
    // Redirect to a previously registered URL, and force an exit
    // to occur when done:
    $this->_redirector->redirectAndExit();
    return; // never reached
  }
}

Example #6 使用默认设定

这个例子假定使用默认设定,也就意味着任何重定向将导致立即退出。

// ALTERNATIVE EXAMPLE
class AlternativeController extends Zend_Controller_Action
{
  /**
   * Redirector - defined for code completion
   *
   * @var Zend_Controller_Action_Helper_Redirector
   */
  protected $_redirector = null;
  public function init()
  {
    $this->_redirector = $this->_helper->getHelper('Redirector');
  }
  public function myAction()
  {
    /* do some stuff */
    $this->_redirector
      ->gotoUrl('/my-controller/my-action/param1/test/param2/test2');
    return; // never reached since default is to goto and exit
  }
}

Example #7 使用goto()的_forward()API

gotoSimple()'s API 模拟了Zend_Controller_Action::_forward()。主要的不同在于它通过传入的参数构造URL,使用默认路由器的默认格式:module/:controller/:action/*。然后重定向而不是继续动作链循环。

class ForwardController extends Zend_Controller_Action
{
  /**
   * Redirector - defined for code completion
   *
   * @var Zend_Controller_Action_Helper_Redirector
   */
  protected $_redirector = null;
  public function init()
  {
    $this->_redirector = $this->_helper->getHelper('Redirector');
  }
  public function myAction()
  {
    /* do some stuff */
    // Redirect to 'my-action' of 'my-controller' in the current
    // module, using the params param1 => test and param2 => test2
    $this->_redirector->gotoSimple('my-action',
    'my-controller',
    null,
    array('param1' => 'test',
       'param2' => 'test2'
       )
    );
  }
}

Example #8 通过gotoRoute()使用路由组装(route assembly)

下面的例子使用了路由器的assemble()方法,基于传入参数的关联数组来创建URL。假定下面的路由已经注册:

$route = new Zend_Controller_Router_Route(
  'blog/:year/:month/:day/:id',
  array('controller' => 'archive',
     'module' => 'blog',
     'action' => 'view')
);
$router->addRoute('blogArchive', $route);

给定一个数组,其中年份为2006,月份为4,日期为24,id为42,据此可以组装URL/blog/2006/4/24/42。

class BlogAdminController extends Zend_Controller_Action
{
  /**
   * Redirector - defined for code completion
   *
   * @var Zend_Controller_Action_Helper_Redirector
   */
  protected $_redirector = null;
  public function init()
  {
    $this->_redirector = $this->_helper->getHelper('Redirector');
  }
  public function returnAction()
  {
    /* do some stuff */
    // Redirect to blog archive. Builds the following URL:
    // /blog/2006/4/24/42
    $this->_redirector->gotoRoute(
      array('year' => 2006,
         'month' => 4,
         'day' => 24,
         'id' => 42),
      'blogArchive'
    );
  }
}

Zend_Controller_Action_Helper_Redirector的源码。

通过源代码不难看出实现方法,以及常见的使用方法。

<&#63;php
/**
 * @see Zend_Controller_Action_Helper_Abstract
 */
require_once 'Zend/Controller/Action/Helper/Abstract.php';
/**
 * @category  Zend
 * @package  Zend_Controller
 * @subpackage Zend_Controller_Action_Helper
 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license  http://framework.zend.com/license/new-bsd   New BSD License
 */
class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_Helper_Abstract
{
  /**
   * HTTP status code for redirects
   * @var int
   */
  protected $_code = 302;
  /**
   * Whether or not calls to _redirect() should exit script execution
   * @var boolean
   */
  protected $_exit = true;
  /**
   * Whether or not _redirect() should attempt to prepend the base URL to the
   * passed URL (if it's a relative URL)
   * @var boolean
   */
  protected $_prependBase = true;
  /**
   * Url to which to redirect
   * @var string
   */
  protected $_redirectUrl = null;
  /**
   * Whether or not to use an absolute URI when redirecting
   * @var boolean
   */
  protected $_useAbsoluteUri = false;
  /**
   * Whether or not to close the session before exiting
   * @var boolean
   */
  protected $_closeSessiOnOnExit= true;
  /**
   * Retrieve HTTP status code to emit on {@link _redirect()} call
   *
   * @return int
   */
  public function getCode()
  {
    return $this->_code;
  }
  /**
   * Validate HTTP status redirect code
   *
   * @param int $code
   * @throws Zend_Controller_Action_Exception on invalid HTTP status code
   * @return true
   */
  protected function _checkCode($code)
  {
    $code = (int)$code;
    if ((300 > $code) || (307 <$code) || (304 == $code) || (306 == $code)) {
      require_once 'Zend/Controller/Action/Exception.php';
      throw new Zend_Controller_Action_Exception('Invalid redirect HTTP status code (' . $code . ')');
    }
    return true;
  }
  /**
   * Retrieve HTTP status code for {@link _redirect()} behaviour
   *
   * @param int $code
   * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface
   */
  public function setCode($code)
  {
    $this->_checkCode($code);
    $this->_code = $code;
    return $this;
  }
  /**
   * Retrieve flag for whether or not {@link _redirect()} will exit when finished.
   *
   * @return boolean
   */
  public function getExit()
  {
    return $this->_exit;
  }
  /**
   * Retrieve exit flag for {@link _redirect()} behaviour
   *
   * @param boolean $flag
   * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface
   */
  public function setExit($flag)
  {
    $this->_exit = ($flag) &#63; true : false;
    return $this;
  }
  /**
   * Retrieve flag for whether or not {@link _redirect()} will prepend the
   * base URL on relative URLs
   *
   * @return boolean
   */
  public function getPrependBase()
  {
    return $this->_prependBase;
  }
  /**
   * Retrieve 'prepend base' flag for {@link _redirect()} behaviour
   *
   * @param boolean $flag
   * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface
   */
  public function setPrependBase($flag)
  {
    $this->_prependBase = ($flag) &#63; true : false;
    return $this;
  }
  /**
   * Retrieve flag for whether or not {@link redirectAndExit()} shall close the session before
   * exiting.
   *
   * @return boolean
   */
  public function getCloseSessionOnExit()
  {
    return $this->_closeSessionOnExit;
  }
  /**
   * Set flag for whether or not {@link redirectAndExit()} shall close the session before exiting.
   *
   * @param boolean $flag
   * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface
   */
  public function setCloseSessionOnExit($flag)
  {
    $this->_closeSessiOnOnExit= ($flag) &#63; true : false;
    return $this;
  }
  /**
   * Return use absolute URI flag
   *
   * @return boolean
   */
  public function getUseAbsoluteUri()
  {
    return $this->_useAbsoluteUri;
  }
  /**
   * Set use absolute URI flag
   *
   * @param boolean $flag
   * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface
   */
  public function setUseAbsoluteUri($flag = true)
  {
    $this->_useAbsoluteUri = ($flag) &#63; true : false;
    return $this;
  }
  /**
   * Set redirect in response object
   *
   * @return void
   */
  protected function _redirect($url)
  {
    if ($this->getUseAbsoluteUri() && !preg_match('#^(https&#63;|ftp)://#', $url)) {
      $host = (isset($_SERVER['HTTP_HOST'])&#63;$_SERVER['HTTP_HOST']:'');
      $proto = (isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=="off") &#63; 'https' : 'http';
      $port = (isset($_SERVER['SERVER_PORT'])&#63;$_SERVER['SERVER_PORT']:80);
      $uri  = $proto . '://' . $host;
      if ((('http' == $proto) && (80 != $port)) || (('https' == $proto) && (443 != $port))) {
        // do not append if HTTP_HOST already contains port
        if (strrchr($host, ':') === false) {
          $uri .= ':' . $port;
        }
      }
      $url = $uri . '/' . ltrim($url, '/');
    }
    $this->_redirectUrl = $url;
    $this->getResponse()->setRedirect($url, $this->getCode());
  }
  /**
   * Retrieve currently set URL for redirect
   *
   * @return string
   */
  public function getRedirectUrl()
  {
    return $this->_redirectUrl;
  }
  /**
   * Determine if the baseUrl should be prepended, and prepend if necessary
   *
   * @param string $url
   * @return string
   */
  protected function _prependBase($url)
  {
    if ($this->getPrependBase()) {
      $request = $this->getRequest();
      if ($request instanceof Zend_Controller_Request_Http) {
        $base = rtrim($request->getBaseUrl(), '/');
        if (!empty($base) && ('/' != $base)) {
          $url = $base . '/' . ltrim($url, '/');
        } else {
          $url = '/' . ltrim($url, '/');
        }
      }
    }
    return $url;
  }
  /**
   * Set a redirect URL of the form /module/controller/action/params
   *
   * @param string $action
   * @param string $controller
   * @param string $module
   * @param array $params
   * @return void
   */
  public function setGotoSimple($action, $cOntroller= null, $module = null, array $params = array())
  {
    $dispatcher = $this->getFrontController()->getDispatcher();
    $request  = $this->getRequest();
    $curModule = $request->getModuleName();
    $useDefaultCOntroller= false;
    if (null === $controller && null !== $module) {
      $useDefaultCOntroller= true;
    }
    if (null === $module) {
      $module = $curModule;
    }
    if ($module == $dispatcher->getDefaultModule()) {
      $module = '';
    }
    if (null === $controller && !$useDefaultController) {
      $cOntroller= $request->getControllerName();
      if (empty($controller)) {
        $cOntroller= $dispatcher->getDefaultControllerName();
      }
    }
    $params[$request->getModuleKey()]   = $module;
    $params[$request->getControllerKey()] = $controller;
    $params[$request->getActionKey()]   = $action;
    $router = $this->getFrontController()->getRouter();
    $url  = $router->assemble($params, 'default', true);
    $this->_redirect($url);
  }
  /**
   * Build a URL based on a route
   *
   * @param array  $urlOptions
   * @param string $name Route name
   * @param boolean $reset
   * @param boolean $encode
   * @return void
   */
  public function setGotoRoute(array $urlOptiOns= array(), $name = null, $reset = false, $encode = true)
  {
    $router = $this->getFrontController()->getRouter();
    $url  = $router->assemble($urlOptions, $name, $reset, $encode);
    $this->_redirect($url);
  }
  /**
   * Set a redirect URL string
   *
   * By default, emits a 302 HTTP status header, prepends base URL as defined
   * in request object if url is relative, and halts script execution by
   * calling exit().
   *
   * $options is an optional associative array that can be used to control
   * redirect behaviour. The available option keys are:
   * - exit: boolean flag indicating whether or not to halt script execution when done
   * - prependBase: boolean flag indicating whether or not to prepend the base URL when a relative URL is provided
   * - code: integer HTTP status code to use with redirect. Should be between 300 and 307.
   *
   * _redirect() sets the Location header in the response object. If you set
   * the exit flag to false, you can override this header later in code
   * execution.
   *
   * If the exit flag is true (true by default), _redirect() will write and
   * close the current session, if any.
   *
   * @param string $url
   * @param array $options
   * @return void
   */
  public function setGotoUrl($url, array $optiOns= array())
  {
    // prevent header injections
    $url = str_replace(array("\n", "\r"), '', $url);
    if (null !== $options) {
      if (isset($options['exit'])) {
        $this->setExit(($options['exit']) &#63; true : false);
      }
      if (isset($options['prependBase'])) {
        $this->setPrependBase(($options['prependBase']) &#63; true : false);
      }
      if (isset($options['code'])) {
        $this->setCode($options['code']);
      }
    }
    // If relative URL, decide if we should prepend base URL
    if (!preg_match('|^[a-z]+://|', $url)) {
      $url = $this->_prependBase($url);
    }
    $this->_redirect($url);
  }
  /**
   * Perform a redirect to an action/controller/module with params
   *
   * @param string $action
   * @param string $controller
   * @param string $module
   * @param array $params
   * @return void
   */
  public function gotoSimple($action, $cOntroller= null, $module = null, array $params = array())
  {
    $this->setGotoSimple($action, $controller, $module, $params);
    if ($this->getExit()) {
      $this->redirectAndExit();
    }
  }
  /**
   * Perform a redirect to an action/controller/module with params, forcing an immdiate exit
   *
   * @param mixed $action
   * @param mixed $controller
   * @param mixed $module
   * @param array $params
   * @return void
   */
  public function gotoSimpleAndExit($action, $cOntroller= null, $module = null, array $params = array())
  {
    $this->setGotoSimple($action, $controller, $module, $params);
    $this->redirectAndExit();
  }
  /**
   * Redirect to a route-based URL
   *
   * Uses route's assemble method tobuild the URL; route is specified by $name;
   * default route is used if none provided.
   *
   * @param array  $urlOptions Array of key/value pairs used to assemble URL
   * @param string $name
   * @param boolean $reset
   * @param boolean $encode
   * @return void
   */
  public function gotoRoute(array $urlOptiOns= array(), $name = null, $reset = false, $encode = true)
  {
    $this->setGotoRoute($urlOptions, $name, $reset, $encode);
    if ($this->getExit()) {
      $this->redirectAndExit();
    }
  }
  /**
   * Redirect to a route-based URL, and immediately exit
   *
   * Uses route's assemble method tobuild the URL; route is specified by $name;
   * default route is used if none provided.
   *
   * @param array  $urlOptions Array of key/value pairs used to assemble URL
   * @param string $name
   * @param boolean $reset
   * @return void
   */
  public function gotoRouteAndExit(array $urlOptiOns= array(), $name = null, $reset = false)
  {
    $this->setGotoRoute($urlOptions, $name, $reset);
    $this->redirectAndExit();
  }
  /**
   * Perform a redirect to a url
   *
   * @param string $url
   * @param array $options
   * @return void
   */
  public function gotoUrl($url, array $optiOns= array())
  {
    $this->setGotoUrl($url, $options);
    if ($this->getExit()) {
      $this->redirectAndExit();
    }
  }
  /**
   * Set a URL string for a redirect, perform redirect, and immediately exit
   *
   * @param string $url
   * @param array $options
   * @return void
   */
  public function gotoUrlAndExit($url, array $optiOns= array())
  {
    $this->setGotoUrl($url, $options);
    $this->redirectAndExit();
  }
  /**
   * exit(): Perform exit for redirector
   *
   * @return void
   */
  public function redirectAndExit()
  {
    if ($this->getCloseSessionOnExit()) {
      // Close session, if started
      if (class_exists('Zend_Session', false) && Zend_Session::isStarted()) {
        Zend_Session::writeClose();
      } elseif (isset($_SESSION)) {
        session_write_close();
      }
    }
    $this->getResponse()->sendHeaders();
    exit();
  }
  /**
   * direct(): Perform helper when called as
   * $this->_helper->redirector($action, $controller, $module, $params)
   *
   * @param string $action
   * @param string $controller
   * @param string $module
   * @param array $params
   * @return void
   */
  public function direct($action, $cOntroller= null, $module = null, array $params = array())
  {
    $this->gotoSimple($action, $controller, $module, $params);
  }
  /**
   * Overloading
   *
   * Overloading for old 'goto', 'setGoto', and 'gotoAndExit' methods
   *
   * @param string $method
   * @param array $args
   * @return mixed
   * @throws Zend_Controller_Action_Exception for invalid methods
   */
  public function __call($method, $args)
  {
    $method = strtolower($method);
    if ('goto' == $method) {
      return call_user_func_array(array($this, 'gotoSimple'), $args);
    }
    if ('setgoto' == $method) {
      return call_user_func_array(array($this, 'setGotoSimple'), $args);
    }
    if ('gotoandexit' == $method) {
      return call_user_func_array(array($this, 'gotoSimpleAndExit'), $args);
    }
    require_once 'Zend/Controller/Action/Exception.php';
    throw new Zend_Controller_Action_Exception(sprintf('Invalid method "%s" called on redirector', $method));
  }
}

更多关于zend相关内容感兴趣的读者可查看本站专题:《Zend FrameWork框架入门教程》、《php优秀开发框架总结》、《Yii框架入门及常用技巧总结》、《ThinkPHP入门教程》、《php面向对象程序设计入门教程》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》

希望本文所述对大家PHP程序设计有所帮助。

推荐阅读
  • Windows下配置PHP5.6的方法及注意事项
    本文介绍了在Windows系统下配置PHP5.6的步骤及注意事项,包括下载PHP5.6、解压并配置IIS、添加模块映射、测试等。同时提供了一些常见问题的解决方法,如下载缺失的msvcr110.dll文件等。通过本文的指导,读者可以轻松地在Windows系统下配置PHP5.6,并解决一些常见的配置问题。 ... [详细]
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • MACElasticsearch安装步骤及验证方法
    本文介绍了MACElasticsearch的安装步骤,包括下载ZIP文件、解压到安装目录、启动服务,并提供了验证启动是否成功的方法。同时,还介绍了安装elasticsearch-head插件的方法,以便于进行查询操作。 ... [详细]
  • 解决VS写C#项目导入MySQL数据源报错“You have a usable connection already”问题的正确方法
    本文介绍了在VS写C#项目导入MySQL数据源时出现报错“You have a usable connection already”的问题,并给出了正确的解决方法。详细描述了问题的出现情况和报错信息,并提供了解决该问题的步骤和注意事项。 ... [详细]
  • IT方面的论坛太多了,有综合,有专业,有行业,在各个论坛里混了几年,体会颇深,以前是论坛哪里人多 ... [详细]
  • CEPH LIO iSCSI Gateway及其使用参考文档
    本文介绍了CEPH LIO iSCSI Gateway以及使用该网关的参考文档,包括Ceph Block Device、CEPH ISCSI GATEWAY、USING AN ISCSI GATEWAY等。同时提供了多个参考链接,详细介绍了CEPH LIO iSCSI Gateway的配置和使用方法。 ... [详细]
  • 安装mysqlclient失败解决办法
    本文介绍了在MAC系统中,使用django使用mysql数据库报错的解决办法。通过源码安装mysqlclient或将mysql_config添加到系统环境变量中,可以解决安装mysqlclient失败的问题。同时,还介绍了查看mysql安装路径和使配置文件生效的方法。 ... [详细]
  • 本文介绍了在Python3中如何使用选择文件对话框的格式打开和保存图片的方法。通过使用tkinter库中的filedialog模块的asksaveasfilename和askopenfilename函数,可以方便地选择要打开或保存的图片文件,并进行相关操作。具体的代码示例和操作步骤也被提供。 ... [详细]
  • EPICS Archiver Appliance存储waveform记录的尝试及资源需求分析
    本文介绍了EPICS Archiver Appliance存储waveform记录的尝试过程,并分析了其所需的资源容量。通过解决错误提示和调整内存大小,成功存储了波形数据。然后,讨论了储存环逐束团信号的意义,以及通过记录多圈的束团信号进行参数分析的可能性。波形数据的存储需求巨大,每天需要近250G,一年需要90T。然而,储存环逐束团信号具有重要意义,可以揭示出每个束团的纵向振荡频率和模式。 ... [详细]
  • 如何去除Win7快捷方式的箭头
    本文介绍了如何去除Win7快捷方式的箭头的方法,通过生成一个透明的ico图标并将其命名为Empty.ico,将图标复制到windows目录下,并导入注册表,即可去除箭头。这样做可以改善默认快捷方式的外观,提升桌面整洁度。 ... [详细]
  • 本文介绍了Redis的基础数据结构string的应用场景,并以面试的形式进行问答讲解,帮助读者更好地理解和应用Redis。同时,描述了一位面试者的心理状态和面试官的行为。 ... [详细]
  • Metasploit攻击渗透实践
    本文介绍了Metasploit攻击渗透实践的内容和要求,包括主动攻击、针对浏览器和客户端的攻击,以及成功应用辅助模块的实践过程。其中涉及使用Hydra在不知道密码的情况下攻击metsploit2靶机获取密码,以及攻击浏览器中的tomcat服务的具体步骤。同时还讲解了爆破密码的方法和设置攻击目标主机的相关参数。 ... [详细]
  • 本文讲述了孙悟空写给白骨精的信件引发的思考和反省。孙悟空在信中对自己的行为进行了反思,认识到自己胡闹的行为并没有给他带来实际的收获。他也揭示了西天取经的真相,认为这是玉皇、菩萨设下的一场陷阱。他还提到了师傅的虚伪和对自己的实心话,以及自己作为师傅准备提拔的对象而被派下来锻炼的经历。他认为路上的九九八十一难也都是菩萨算计好的,唐僧并没有真正的危险。最后,他提到了观音菩萨在关键时刻的指导。这封信件引发了孙悟空对自己行为的思考和反省,对西天取经的目的和自己的角色有了更深入的认识。 ... [详细]
  • Windows2003 IIS上设置301定向,实现不带www域名跳转带www域名的方法
    打开IIS,建一个网站,主机头用不带www的域名,随便指向一个目录。然后在这个网站上点右键,属性--主目录--重定向到URL如图ÿ ... [详细]
  • Postgresql备份和恢复的方法及命令行操作步骤
    本文介绍了使用Postgresql进行备份和恢复的方法及命令行操作步骤。通过使用pg_dump命令进行备份,pg_restore命令进行恢复,并设置-h localhost选项,可以完成数据的备份和恢复操作。此外,本文还提供了参考链接以获取更多详细信息。 ... [详细]
author-avatar
晓梦
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有