php-使用文本文件中的值注册变量 [英] php-Register variables with values ​​in a text file

查看:82
本文介绍了php-使用文本文件中的值注册变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有 php 语言页面

我要求写一段代码放入第一个自动初始化每个变量的板块带有页面名称的文件名,然后 Reg.txt 打印

示例



Hi I have a page in php language
I asked to write a piece of code to put in the first plates that automatically initialize variables in each file name with the name of the page and then it Reg.txt Print
Example

<?php
$aday = 100;
$stdNames = array("Name1", "Name2", "Name3", "Name4", "Name5");
$aday = (16 + 1);
$_SESSION['hello'] = 'hello';
$id = $aday;
.
.
.
.
include("connection.php");
.
.
.
.
$DB=mysql_query("SELECT * FROM users where `userid`='$id' " );
$row = mysql_fetch_assoc($DB(3));
.
.
.
?>






and

<?php
/*connection.php*/
.
.
.
$SQL_USER = 'username';
$SQL_PASS = 'password';
.
.
.
$this->connection = mysql_connect(SQL_SERVER, $SQL_USER, $SQL_PASS);
mysql_select_db(SQL_DB, $this->connection);
.
.
.
?>





Reg.txt



Reg.txt

Reg :

page one   18:30

18:30
aday :   100
------------
18:30
stdNames :  Name1,Name2,Name3,Name4,Name5
------------
18:31
aday :   17
------------
18:32
session 'hello' :    hello
------------
18:32
id :   17
------------
.
.
.
page connection    18:33

18:33
SQL_USER :    username
------------
18:34
SQL_PASS :    password
------------
.
.
.
18:35
end page connection
------------
18:38
DB :  userid,number1,number2,number3,number4,number5 :
17,12,33,678,1,54
17,45,67,124,56,98
17,987,50,123,34,76
17,15,87,65,489,62
17,18,65,47,25,286
------------
18:38
row :  userid,number1,number2,number3,number4,number5 :
17,987,50,123,34,76
------------
.
.
.
18:42
endpage one
------------

推荐答案

aday = 100 ;
aday = 100;


stdNames = array( Name1 Name2 Name3 Name4 Name5);
stdNames = array("Name1", "Name2", "Name3", "Name4", "Name5");


aday =(16 + 1);
aday = (16 + 1);


这篇关于php-使用文本文件中的值注册变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆