zend 프레임워크는 SQL Server를 지원하는 작업 방법을 구현합니다.
본 글의 예시에서는 SQL Server를 지원하기 위한 zend Framework의 동작 방식을 설명합니다. 참고할 수 있도록 모든 사람과 공유하세요. 자세한 내용은 다음과 같습니다.
1. Zend/Db/Adapter/Pdo/Abstract.php에서 연결 방법을 수정합니다.
protected function _connect() { // if we already have a PDO object, no need to re-connect. if ($this->_connection) { return; } // get the dsn first, because some adapters alter the $_pdoType $dsn = $this->_dsn(); // check for PDO extension if (!extension_loaded('pdo')) { /** * [url=home.php?mod=space&uid=86763]@see[/url] Zend_Db_Adapter_Exception */ require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception('The PDO extension is required for this adapter but the extension is not loaded'); } // check the PDO driver is available if (!in_array($this->_pdoType, PDO::getAvailableDrivers())) { /** * @see Zend_Db_Adapter_Exception */ require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception('The ' . $this->_pdoType . ' driver is not currently installed'); } // create PDO connection $q = $this->_profiler->queryStart('connect', Zend_Db_Profiler::CONNECT); // add the persistence flag if we find it in our config array if (isset($this->_config['persistent']) && ($this->_config['persistent'] == true)) { $this->_config['driver_options'][PDO::ATTR_PERSISTENT] = true; } try { //print_r($this->_config);exit; if($this->_config['pdoType']=='sqlsrv'){ $this->_connection = new PDO( "sqlsrv:Server=".$this->_config['host'].";Database = ".$this->_config['dbname'], $this->_config['username'], $this->_config['password']); $this->_connection->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $this->_connection->setAttribute( PDO::SQLSRV_ATTR_ENCODING, PDO::SQLSRV_ENCODING_UTF8 ); $this->_profiler->queryEnd($q); }elseif ($this->_config['pdoType']=='dblib') { $this->_connection = new PDO( $dsn, $this->_config['username'], $this->_config['password'], $this->_config['driver_options'] ); $this->_profiler->queryEnd($q); } // set the PDO connection to perform case-folding on array keys, or not $this->_connection->setAttribute(PDO::ATTR_CASE, $this->_caseFolding); // always use exceptions. $this->_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { /** * @see Zend_Db_Adapter_Exception */ require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception($e->getMessage()); } }
여기서 Linux와 Windows의 두 가지 연결 방법이 제공됩니다.
2.mssql.php는 보호됩니다 $_pdoType = 'sqlsrv';
protected function _dsn() { // baseline of DSN parts $dsn = $this->_config; // don't pass the username and password in the DSN unset($dsn['username']); unset($dsn['password']); unset($dsn['driver_options']); if (isset($dsn['port'])) { $seperator = ':'; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $seperator = ','; } $dsn['host'] .= $seperator . $dsn['port']; unset($dsn['port']); } // this driver supports multiple DSN prefixes // @see http://www.php.net/manual/en/ref.pdo-dblib.connection.php //print_r($dsn);exit; if (isset($dsn['pdoType'])) { switch (strtolower($dsn['pdoType'])) { case 'freetds': case 'sybase': $this->_pdoType = 'sybase'; break; case 'mssql': $this->_pdoType = 'mssql'; break; case 'sqlsrv': $this->_pdoType = 'sqlsrv'; break; case 'dblib': default: $this->_pdoType = 'dblib'; break; } unset($dsn['pdoType']); } // use all remaining parts in the DSN foreach ($dsn as $key => $val) { $dsn[$key] = "$key=$val"; } $dsn = $this->_pdoType . ':' . implode(';', $dsn); // print_r($dsn);exit; return $dsn; }
3.ZF의 web.xml 데이터베이스 구성 파일이 다음으로 변경되었습니다.
<db> <adapter>PDO_MSSQL</adapter> <config> <host>localhost</host> <username>sa</username> <password>123456</password> <dbname>testdb </dbname> <pdoType>sqlsrv</pdoType> </config> </db>
해당 기간 동안 중국어 문자가 깨졌습니다.
function convert2utf8($string) { $config = $this->getCfg(); $pdoType = $config->db->config->pdoType; if($pdoType == 'dblib'){ return iconv("gbk","utf-8",$string); }elseif($pdoType == 'sqlsrv'){ return mb_convert_encoding($string,"UTF-8","auto"); } } function convert2gbk($string) { $config = $this->getCfg(); $pdoType = $config->db->config->pdoType; if($pdoType == 'dblib'){ return iconv("utf-8","gbk",$string); }elseif($pdoType == 'sqlsrv'){ return mb_convert_encoding($string,"GBK","auto"); } } protected function &getCfg() { if ($this->cfg_ === null) { $registry = Zend_Registry::getInstance(); $this->cfg_ = $registry->get('web_config'); } return $this->cfg_; }
유형별로 다른 처리를 수행합니다.
더 많은 컨텐츠를 보시려면 PHP 중국어 홈페이지(www.php.cn)를 주목해주세요!

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











WindowsServerBackup은 WindowsServer 운영 체제와 함께 제공되는 기능으로, 사용자가 중요한 데이터 및 시스템 구성을 보호하고 중소기업 및 대기업 수준의 기업에 완벽한 백업 및 복구 솔루션을 제공하도록 설계되었습니다. Server2022 이상을 실행하는 사용자만 이 기능을 사용할 수 있습니다. 이 문서에서는 WindowsServerBackup을 설치, 제거 또는 재설정하는 방법을 설명합니다. Windows Server 백업을 재설정하는 방법 서버 백업에 문제가 있거나 백업에 너무 오랜 시간이 걸리거나 저장된 파일에 액세스할 수 없는 경우 Windows Server 백업 설정을 재설정하는 것을 고려할 수 있습니다. Windows를 재설정하려면

Microsoft는 Windows Server 빌드 26040 버전을 출시하면서 제품의 공식 이름을 Windows Server 2025로 발표했습니다. Windows11WindowsInsiderCanaryChannel 버전 build26040도 출시되었습니다. 일부 친구들은 수년 전에 누군가 Windows NT를 워크스테이션 모드에서 서버 모드로 성공적으로 전환하여 다양한 버전의 Microsoft 운영 체제 간의 공통점을 보여주었다는 것을 아직도 기억할 것입니다. 마이크로소프트의 현재 서버 운영체제 버전과 윈도우 11 사이에는 뚜렷한 차이가 있지만, 세부 사항에 주목하는 사람들은 윈도우 서버가 왜 브랜드를 업데이트했는지,

Zend Framework에서 권한 제어를 위해 ACL(AccessControlList)을 사용하는 방법 소개: 웹 애플리케이션에서 권한 제어는 중요한 기능입니다. 이는 사용자가 액세스 권한이 있는 페이지와 기능에만 액세스할 수 있도록 하고 무단 액세스를 방지합니다. Zend 프레임워크는 ACL(AccessControlList) 구성 요소를 사용하여 권한 제어를 구현하는 편리한 방법을 제공합니다. 이 기사에서는 Zend Framework에서 ACL을 사용하는 방법을 소개합니다.

PHP 구현 프레임워크: ZendFramework 입문 튜토리얼 ZendFramework는 PHP에서 개발하고 현재 ZendTechnologies에서 유지 관리하는 오픈 소스 웹 사이트 프레임워크입니다. ZendFramework는 MVC 디자인 패턴을 채택하고 Web2.0 애플리케이션 및 Web Serve 구현을 지원하기 위한 재사용 가능한 코드 라이브러리 시리즈를 제공합니다. ZendFramework는 PHP 개발자들에게 매우 인기 있고 존경받고 있으며 다양한 기능을 갖추고 있습니다.

nginx의 기본 이름을 수정하는 방법은 조금 위장하거나 설치할 수 있습니다. 팁: 일반적으로 수정은 nginx가 컴파일되기 전에 이루어집니다. 수정 후에는 scr/core/nginx.conf#definenginx_version"1.4.7"#definenginx_ver"nginx/"n과 같이 코드를 다시 컴파일해야 합니다.

Microsoft는 데스크톱용 Win11 미리 보기 업데이트를 출시하는 동시에 Windows Server LTSC(장기 서비스 채널) 미리 보기 빌드 25335도 오늘 출시했습니다. 평소와 마찬가지로 Microsoft는 전체 변경 로그를 게시하지 않았으며 해당 블로그 게시물도 제공하지 않았습니다. Microsoft는 Windows Server 미리보기 버전 업데이트 로그를 Canary 채널 버전과 동일하게 조정했습니다. 새로운 콘텐츠가 도입되지 않으면 공식 블로그 게시물이 게시되지 않습니다. IT 홈의 참고 사항: 서버 브랜드는 업데이트되지 않았으며 미리 보기 버전에서는 여전히 Windows Server 2022입니다. 또한 Microsoft는 이미 시장에 출시된 Windows Server 2019 버전 대신 이러한 버전을 Windows Server vNext라고 부릅니다.

Ubuntu Server 11.04를 설치할 때 그래픽 인터페이스를 설치할 필요가 없다고 생각한다면 아직 완성되지 않은 GNOME 3는 말할 것도 없습니다. . 아니면 ARCH+GNOME3으로 빌드해야 합니다. 그러니 이 글을 읽으면서 시간을 낭비하지 마시기 바랍니다. 2박1일 걸렸고 N번 재설치 했습니다. 마침내 뭔가가 나왔습니다. 쉽지 않습니다. 더 이상 고민하지 않고 본론으로 들어가겠습니다. 하드웨어: ThinkPad 1개 (X61의 경우) 2. 부팅 옵션 인터페이스로 들어가서 USB 부팅을 선택한 다음 Ubu 설치를 선택합니다.

1월 16일 보도에 따르면, 외국 기술 매체인 WindowsLatest는 Windows Server 2022에 KB5034129 업데이트를 설치한 후 Chrome, Edge, Firefox 브라우저는 물론 Adobe 및 기타 애플리케이션에서 흰색 화면이 나타나 콘텐츠를 표시할 수 없게 된다고 보도했습니다. 2024년 1월 패치 화요일 이벤트 동안 Microsoft는 Windows Server 2022의 Wi-Fi 어댑터 문제를 해결하도록 설계된 KB5034129 업데이트를 출시했습니다. 이 업데이트는 널리 권장되며 시스템 안정성과 성능을 보장하기 위해 많은 회사에서 설치해야 합니다. 그러나 설치 및 업그레이드 후 많은 사용자가 Windows Server 2022 업데이트로 인해
