关于dsn的有关问题
关于dsn的问题
最近在codeigniter中使用dsn进行数据库连接,但是不管端口号改成什么总是能够连接成功,而修改用户名,密码或ip地址的话就会出现连接失败的问题,下面是我的代码
- PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> function get_remote_dblist($ip, $port, $user, $pwd) { $dsn = "mysql://$user:$pwd@$ip:$port"; $newDB = $this->load->database ( $dsn , TRUE );return $newDB->version();}
烦请各位前辈指点下
------解决方案--------------------
CI的官方文档中并未提及DSN中主机名可以附加端口号。有一个折衷的方法你可以试试
- PHP code
$dsn = "mysql://{$user}:{$pwd}@{$ip}/?port={$port}";<div class="clear"> </div>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



pwd in Linux means a common command in Linux. It is a command commonly used by Linux system administrators and ordinary users. It can help users quickly find the current directory, facilitate users to better manage files and directories, and can also help administrators and Users can quickly locate certain specific directories or files to better manage the Linux system.

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

Last week, Paul Gele, a known gaming insider, shared that the upcoming Nintendo Switch 2 will get major third-party AAA ports at launch. This is something to look forward to because the first-gen gaming handheld didn't get any AAA titles at launch. B

In Docker, the permission problem of the mounting directory can usually be solved by the following method: adding permission-related options when using the -v parameter to specify the mounting directory. You can specify the permissions of the mounted directory by adding: ro or :rw after the mounted directory, indicating read-only and read-write permissions respectively. For example: dockerrun-v/host/path:/container/path:roimage_name Define the USER directive in the Dockerfile to specify the user running in the container to ensure that operations inside the container comply with permission requirements. For example: FROMimage_name#CreateanewuserRUNuseradd-ms/bin/

In Linux, use the pwd command to view the full path of the "current working directory". Simply put, whenever you operate in the terminal, you will have a current working directory. When the current location is uncertain, pwd is used to determine the exact location of the current directory in the file system. 1. Command format: pwd[option]2. Command function: View the full path of the "current working directory" 3. Commonly used parameters: Generally without any parameters, if the directory is a link: Format: pwd-p displays the actual path instead of using the link path. 4. Commonly used examples: Example 1: Use the pwd command to view the full path of the default working directory Command: pwd output: Copy the code The code is as follows: [root@localh

In Linux, the full name of pwd is print working directory, which means printing the current working directory; the function of the pwd command is to display the current directory, and the syntax is "pwd [option]". The pwd command is mainly used to view the absolute path of the current directory when the current location is not certain.

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没问题。

图片消失如何解决先是图片文件上传$file=$_FILES['userfile']; if(is_uploaded_file($file['tmp_name'])){$query=mysql_query("INSERT INTO gdb_banner(image_src ) VALUES ('images/{$file['name'
