When I press the 'refresh' button on my browser, it seems that $_POST
variable is preserved across the refresh.
If I want to delete the contents of $_POST
what should I do? Using unset
for the fields of $_POST
did not help.
Help? Thanks!
When I press the 'refresh' button on my browser, it seems that $_POST
variable is preserved across the refresh.
If I want to delete the contents of $_POST
what should I do? Using unset
for the fields of $_POST
did not help.
Help? Thanks!
Here's what worked best for me when trying to script this (in case anyone else comes across this like I did):
$ pecl -d php_suffix=5.6 install <package>
$ pecl uninstall -r <package>
$ pecl -d php_suffix=7.0 install <package>
$ pecl uninstall -r <package>
$ pecl -d php_suffix=7.1 install <package>
$ pecl uninstall -r <package>
The -d php_suffix=<version>
piece allows you to set config values at run time vs pre-setting them with pecl config-set
. The uninstall -r
bit does not actually uninstall it (from the docs):
[email protected]:~$ pecl help uninstall
pecl uninstall [options] [channel/]<package> ...
Uninstalls one or more PEAR packages. More than one package may be
specified at once. Prefix with channel name to uninstall from a
channel not in your default channel (pecl.php.net)
Options:
...
-r, --register-only
do not remove files, only register the packages as not installed
...
The uninstall line is necessary otherwise installing it will remove any previously installed version, even if it was for a different PHP version (ex: Installing an extension for PHP 7.0 would remove the 5.6 version if the package was still registered as installed).
require()
and include()
will open the file corresponding to the path/name they receive.
Which means that, with your code, you would have to have a file called diggstyle_code.php?page=1
on your disk. That's obviously not the case, so it fails.
Quoting the Variable scope page of the PHP Manual:
The scope of a variable is the context within which it is defined. For the most part all PHP variables only have a single scope. This single scope spans included and required files as well.
In your case, you don't need to pass the variable. If you have a variable in your current script, it will also exist in the script you include, outside of functions, which have their own scope.
In your main script, you should have:
$page_no = 10;
require 'diggstyle_code.php';
And in diggstyle_code.php
:
echo $page_no;
// Or work with $page_no the way you have to
Remember that including/requiring a file is exactly the same as copy-pasting its content at the line it's required.
this script seems to be like this topic enter link description here
but you can do it easily by mkdir a new directory on your pc then upload it to your server by this simple script
#!/bin/bash
Your Server credentials
ftp_server='******'
ftp_username='******'
ftp_password='******'
New folder with date in year with month and day
slideshow="`date +'%Y-%m-%d'`"
new_folder=`mkdir $slideshow`
Access Your Server via ftp then authenticate to your server
ftp -n $ftp_server <<END_SCRIPT
quote USER $ftp_username
quote PASS $ftp_password
Upload your new created folder
put $new_folder
then quit
quit
END_SCRIPT
full script
#!/bin/bash
ftp_server='********'
ftp_username='********'
ftp_password='********'
slideshow="`date +'%Y-%m-%d'`"
new_folder=`mkdir $slideshow`
ftp -n $ftp_server <<END_SCRIPT
quote USER $ftp_username
quote PASS $ftp_password
put $new_folder
quit
END_SCRIPT
Never used any of those, but they look interesting..
Take a look at Gearman as well.. more overhead in systems like these but you get other cool stuff :) Guess it depends on your needs ..
The request header contains some POST data. No matter what you do, when you reload the page, the rquest would be sent again.
The simple solution is to redirect to a new (if not the same) page. This pattern is very common in web applications, and is called Post/Redirect/Get. It's typical for all forms to do a POST, then if successful, you should do a redirect.
Try as much as possible to always separate (in different files) your view script (html mostly) from your controller script (business logic and stuff). In this way, you would always post data to a seperate controller script and then redirect back to a view script which when rendered, will contain no POST data in the request header.