新聞中心
網(wǎng)站數(shù)據(jù)庫如何修改 config.php文件的配置問題?
$db_host = "數(shù)據(jù)庫地址:3306";\x0d\x0a// database name\x0d\x0a$db_name = "數(shù)據(jù)表名";\x0d\x0a// database username\x0d\x0a$db_user = "數(shù)據(jù)庫用戶名";\x0d\x0a// database password\x0d\x0a$db_pass = "數(shù)據(jù)庫密碼";\x0d\x0a// table prefix\x0d\x0a將這上面的“數(shù)據(jù)庫地址”改為空間服務(wù)商給你的數(shù)據(jù)庫地址,將"數(shù)據(jù)表名"改為空間服務(wù)商給你的數(shù)據(jù)庫中的數(shù)據(jù)庫名稱,將"數(shù)據(jù)庫用戶名"改為空間服務(wù)商給你的數(shù)據(jù)庫的的賬戶名稱,將"數(shù)據(jù)庫密碼"改為空間服務(wù)商給你的數(shù)據(jù)庫的賬戶密碼。以上的數(shù)據(jù)只改“”里面的東西,“”不要去掉。然后將這個文件上傳到空間根目錄即可。
成都創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站制作、做網(wǎng)站、外貿(mào)營銷網(wǎng)站建設(shè)、河源網(wǎng)絡(luò)推廣、小程序設(shè)計、河源網(wǎng)絡(luò)營銷、河源企業(yè)策劃、河源品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎;成都創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供河源建站搭建服務(wù),24小時服務(wù)熱線:18980820575,官方網(wǎng)址:www.cdcxhl.com
thinkphp配置數(shù)據(jù)庫文件在哪
thinkphp\common文件夾中的convention.php中是tp的核心配置文件,不能亂動,如果要想更改里面的配置,在conf
文件夾里面的config.php可以配置,可以這樣寫
?php
return
array(
'db_type'
=
'mysql',//
數(shù)據(jù)庫類型
'db_host'
=
'127.0.0.1',//
數(shù)據(jù)庫服務(wù)器地址
'db_name'
=
'thinkphp',//
數(shù)據(jù)庫名稱
'db_user'
=
'root',//
數(shù)據(jù)庫用戶名
'db_pwd'
=
'123',//
數(shù)據(jù)庫密碼
'db_prefix'
=
'tp_',//
數(shù)據(jù)表前綴
'db_charset'
=
'utf8',//
網(wǎng)站編碼
'db_port'
=
'3306',//
數(shù)據(jù)庫端口
'app_debug'
=
false,//
開啟調(diào)試模式
);
?
也可以在最外邊寫,就是與thinkphp框架同一目錄中寫一個config.php文件,格式如同上面的一樣,不過在conf
文件夾里面的config.php中得包含最外邊的那個config.php
php網(wǎng)站如何配置-mysql數(shù)據(jù)庫如何設(shè)置
第一步:下載源程序下來
第二步:登陸到原來的phpmyadmin,將你的數(shù)據(jù)庫導(dǎo)出為sql文件
第三步:將程序上傳到新的空間并修改數(shù)據(jù)庫連接參數(shù)
第四步:登陸新的phpmyadmin,將sql數(shù)據(jù)備份文件導(dǎo)入到相應(yīng)的數(shù)據(jù)庫
phpcms v9網(wǎng)站的數(shù)據(jù)庫配置文件在哪
正確找到phpcms數(shù)據(jù)庫配置文件的步驟如下(有兩個文件需要更改):
1.根目錄文件夾/caches/configs/database.php;
2.根目錄文件夾/phpsso_server/caches/configs/database.php
php連接 mysql 數(shù)據(jù)庫如何添加一個公共的配置文件
php面向?qū)ο笪募鸇B.class.php
?php
header("content-type:text/html;charset=utf-8");
class?DB{
?public?$db_host;//localhost
?public?$db_user;//用戶名
?public?$db_pwd;//密碼
?public?$db_name;//數(shù)據(jù)庫名
?public?$links;//鏈接名稱
?//構(gòu)造方法的參數(shù)和屬性名字一致,但是含義不同
?function?__construct($db_host,$db_user,$db_pwd,$db_name){
?$this?-?db_host?=?db_host;
?$this?-?db_user?=?db_user;
?$this?-?db_pwd?=?db_pwd;
?$this?-?db_name?=?db_name;
?//鏈接數(shù)據(jù)庫代碼
?$this?-?links?=?@mysql_connect($db_host,$db_user,$db_pwd)or?die("數(shù)據(jù)庫鏈接失敗");
?//echo?$this?-?links;打印是資源
?mysql_query("set?names?utf8");
?mysql_select_db($db_name,$this-links);
?
?}
?function?query($sql){//執(zhí)行各種sql,inert?update?delete執(zhí)行,如果執(zhí)行select返回結(jié)果集
?return?mysql_query($sql);
?}
?function?numRows($sql){//返回select的記錄數(shù)
?$result?=?$this?-?query($sql);
?$count?=?mysql_num_rows($result);
?return?$count;
?}
?function?getOne($sql){//得到一條記錄的一維數(shù)組
?$result?=?$this?-?query($sql);
?$arr?=?mysql_fetch_assoc($result);
?return?$arr;
?}
?function?getAll($sql){//得到多條記錄的二維數(shù)組
?$result?=?$this?-?query($sql);
?$rows?=?array();
?while($rs?=?mysql_fetch_assoc($result)){
?$rows[]?=?$rs;
?}
?return?$rows;
?}
?function?__destruct(){
?$this?-?db_host?=?db_host;
?$this?-?db_user?=?db_user;
?$this?-?db_pwd?=?db_pwd;
?$this?-?db_name?=?db_name;
?}
?}
?
?$db?=?new?DB("localhost","root","","car");
?//$sql?=?"insert?into?category(categoryName)values('常熟seo')";
?//$db?-?query($sql);
?
?//返回select的記錄數(shù)
?//$sql?=?"select?*?from?category";
?//$count?=?$db?-?numRows($sql);
?//echo?$count;
?
?//得到一條記錄的一維數(shù)組
?//$sql?=?"select?*?from?category?where?categoryId=1";
?//$arr?=?$db?-?getOne($sql);
?//print_r($arr);
?
?//得到多條記錄的二維數(shù)組
?$sql?=?"select?*?from?category";
?$rs?=?$db?-?getAll($sql);
?print_r($rs);
?
?
?
創(chuàng)建一個數(shù)據(jù)庫大類
本文標(biāo)題:php配置文件數(shù)據(jù)庫,PHP配置
文章起源:http://www.dlmjj.cn/article/dsgiscs.html