本文目錄一覽:
- 1、求助PHP問題!!
- 2、求助用php或 js編一個類似倒計時的工具。就是實時現顯示過去某個時間點到現在的時間間隔,就像倒計
- 3、求助:用php一次更新10萬條記錄怎麼辦
- 4、高分求助,用PHP語言或SQL語句整理一個數據得到一個新的樣式?
- 5、php文件怎麼用?求助!!!
- 6、PHP求助,求大神幫助用PHP和MYSQL知識編寫一道基礎題。
求助PHP問題!!
可以啊
比如你的頁面是index.php
裡邊的內容如下
?php
if($_GET[‘mod’] ==1){
$smarty-display(“1.html”);
}elseif($_GET[‘mod’] == 2){
$smarty-display(“2.html”);
}
//依次類推
?
求助用php或 js編一個類似倒計時的工具。就是實時現顯示過去某個時間點到現在的時間間隔,就像倒計
這個東西只有用js來實現,
script type=”text/javascript” src=”js/jquery.min.js”/script
script type=”text/javascript”
var intDiff = parseInt(60);//倒計時總秒數量
function timer(intDiff){
window.setInterval(function(){
var day=0,
hour=0,
minute=0,
second=0;//時間默認值
if(intDiff 0){
day = Math.floor(intDiff / (60 * 60 * 24));
hour = Math.floor(intDiff / (60 * 60)) – (day * 24);
minute = Math.floor(intDiff / 60) – (day * 24 * 60) – (hour * 60);
second = Math.floor(intDiff) – (day * 24 * 60 * 60) – (hour * 60 * 60) – (minute * 60);
}
if (minute = 9) minute = ‘0’ + minute;
if (second = 9) second = ‘0’ + second;
$(‘#day_show’).html(day+”天”);
$(‘#hour_show’).html(‘s id=”h”/s’+hour+’時’);
$(‘#minute_show’).html(‘s/s’+minute+’分’);
$(‘#second_show’).html(‘s/s’+second+’秒’);
intDiff–;
}, 1000);
}
$(function(){
timer(intDiff);
});
/script
求助:用php一次更新10萬條記錄怎麼辦
檢查下 php.ini 文件中的限制
upload_max_filesize
post_max_size
如果超出你提交的文件大小,就改大一些
改了之後重啟 apache!
高分求助,用PHP語言或SQL語句整理一個數據得到一個新的樣式?
$sql=”select CONCAT(‘{\”‘,daima,’\”:\”‘,jiancheng,’\”}’) from phpcms_z1_gegu”;
$rs=mysql_query($sql);
$arr=array();
while($row=mysql_fetch_array($rs))
{
$arr[]=$row[0];
}
$arr= implode(‘,’,$arr);
$some=$arr;
php文件怎麼用?求助!!!
PHP是一個網頁腳本,但不同於html xml 標籤語言,直接可以通過瀏覽器打開,需要有PHP的運行環境才可以訪問和打開文件,如果只是編輯PHP打開文件,只需要用記事本或者通過相關的編輯器如(DW、EclipsePHP、editplus 等)打開編輯即可。
PHP求助,求大神幫助用PHP和MYSQL知識編寫一道基礎題。
?php
class OneFileLoginApplication
{
private $db_type = “sqlite”;
private $db_sqlite_path = “./users.db”;
private $db_connection = null;
private $user_is_logged_in = false;
public $feedback = “”;
public function __construct()
{
if ($this-performMinimumRequirementsCheck()) {
$this-runApplication(); } }
private function performMinimumRequirementsCheck()
{
if (version_compare(PHP_VERSION, ‘5.3.7’, ”)) {
echo “Sorry, Simple PHP Login does not run on a PHP version older than 5.3.7 !”;
} elseif (version_compare(PHP_VERSION, ‘5.5.0’, ”)) {
require_once(“libraries/password_compatibility_library.php”);
return true;
} elseif (version_compare(PHP_VERSION, ‘5.5.0’, ‘=’)) {
return true;
} return false;}
public function runApplication()
{
if (isset($_GET[“action”]) $_GET[“action”] == “register”) {
$this-doRegistration();
$this-showPageRegistration();
} else {
$this-doStartSession();
$this-performUserLoginAction();
if ($this-getUserLoginStatus()) {
$this-showPageLoggedIn();
} else {
$this-showPageLoginForm();
}}}
private function createDatabaseConnection()
{
try {
$this-db_connection = new PDO($this-db_type . ‘:’ . $this-db_sqlite_path);
return true;
} catch (PDOException $e) {
$this-feedback = “PDO database connection problem: ” . $e-getMessage();
} catch (Exception $e) {
$this-feedback = “General problem: ” . $e-getMessage();
}
return false;
}
private function performUserLoginAction()
{
if (isset($_GET[“action”]) $_GET[“action”] == “logout”) {
$this-doLogout();
} elseif (!empty($_SESSION[‘user_name’]) ($_SESSION[‘user_is_logged_in’])) {
$this-doLoginWithSessionData();
} elseif (isset($_POST[“login”])) {
$this-doLoginWithPostData();
}}
private function doStartSession()
{ session_start(); }
private function doLoginWithSessionData()
{ $this-user_is_logged_in = true; }
private function doLoginWithPostData()
{ if ($this-checkLoginFormDataNotEmpty()) {
if ($this-createDatabaseConnection())
{ $this-checkPasswordCorrectnessAndLogin(); }}}
private function doLogout()
{ $_SESSION = array();
session_destroy();
$this-user_is_logged_in = false;
$this-feedback = “You were just logged out.”; }
private function doRegistration()
{ if ($this-checkRegistrationData()) {
if ($this-createDatabaseConnection()) {
$this-createNewUser(); }}
return false; }
private function checkLoginFormDataNotEmpty()
{
if (!empty($_POST[‘user_name’]) !empty($_POST[‘user_password’])) {
return true;
} elseif (empty($_POST[‘user_name’])) {
$this-feedback = “Username field was empty.”;
} elseif (empty($_POST[‘user_password’])) {
$this-feedback = “Password field was empty.”;
} return false; }
private function checkPasswordCorrectnessAndLogin()
{
$sql = ‘SELECT user_name, user_email, user_password_hash
FROM users
WHERE user_name = :user_name OR user_email = :user_name
LIMIT 1′;
$query = $this-db_connection-prepare($sql);
$query-bindValue(‘:user_name’, $_POST[‘user_name’]);
$query-execute();
$result_row = $query-fetchObject();
if ($result_row) {
if (password_verify($_POST[‘user_password’], $result_row-user_password_hash)) {
$_SESSION[‘user_name’] = $result_row-user_name;
$_SESSION[‘user_email’] = $result_row-user_email;
$_SESSION[‘user_is_logged_in’] = true;
$this-user_is_logged_in = true;
return true;
} else { $this-feedback = “Wrong password.”; }
} else { $this-feedback = “This user does not exist.”; }
return false; }
private function checkRegistrationData()
{ if (!isset($_POST[“register”])) {
return false; }
if (!empty($_POST[‘user_name’])
strlen($_POST[‘user_name’]) = 64
strlen($_POST[‘user_name’]) = 2
preg_match(‘/^[a-z\d]{2,64}$/i’, $_POST[‘user_name’])
!empty($_POST[‘user_email’])
strlen($_POST[‘user_email’]) = 64
filter_var($_POST[‘user_email’], FILTER_VALIDATE_EMAIL)
!empty($_POST[‘user_password_new’])
!empty($_POST[‘user_password_repeat’])
($_POST[‘user_password_new’] === $_POST[‘user_password_repeat’])
) {
return true;
} elseif (empty($_POST[‘user_name’])) {
$this-feedback = “Empty Username”;
} elseif (empty($_POST[‘user_password_new’]) || empty($_POST[‘user_password_repeat’])) {
$this-feedback = “Empty Password”;
} elseif ($_POST[‘user_password_new’] !== $_POST[‘user_password_repeat’]) {
$this-feedback = “Password and password repeat are not the same”;
} elseif (strlen($_POST[‘user_password_new’]) 6) {
$this-feedback = “Password has a minimum length of 6 characters”;
} elseif (strlen($_POST[‘user_name’]) 64 || strlen($_POST[‘user_name’]) 2) {
$this-feedback = “Username cannot be shorter than 2 or longer than 64 characters”;
} elseif (!preg_match(‘/^[a-z\d]{2,64}$/i’, $_POST[‘user_name’])) {
$this-feedback = “Username does not fit the name scheme: only a-Z and numbers are allowed, 2 to 64 characters”;
} elseif (empty($_POST[‘user_email’])) {
$this-feedback = “Email cannot be empty”;
} elseif (strlen($_POST[‘user_email’]) 64) {
$this-feedback = “Email cannot be longer than 64 characters”;
} elseif (!filter_var($_POST[‘user_email’], FILTER_VALIDATE_EMAIL)) {
$this-feedback = “Your email address is not in a valid email format”;
} else {
$this-feedback = “An unknown error occurred.”;
} return false; }
//沒辦法,不允許發這麼多字;
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/287373.html