Category Archives: PHP
I've been getting into trouble for several hours with redirecting to the 404 page in Zend Framework 2. The question in StackOverflow: http://stackoverflow.com/questions/21622849/use-the-same-error-handler-in-different-modules-in-zend-framework-2 Before that, I'm using the following code: It works fine. However, after I create the 404 error page. I found it won't redirect you to the error page with the code above. If you want to redirect to the 404 error page, you should use the following code:
Download PHP Windows downloads of PHP are available here. If you are not sure of which version to get, check out this Stack Overflow page. I used the VC11 thread-safe PHP 5.5.0 download. Install PHP Once you’ve downloaded the installer, run it and install PHP in C:php (or wherever you like, but remember that the path should not contain spaces). Choose your webserver (or none if you don’t have a webserver installed) and select any additional components as needed, including PEAR. Once PHP is installed open a command prompt. Check that PHP is set up correctly by running It should give you output something like If you don’t get this output something has gone wrong with the PHP install or in the modification of…
To access CodeIgniter's native resources within your library use the get_instance() function. This function returns the CodeIgniter super object. Normally from within your controller functions, you will call any of the available CodeIgniter functions using the $this construct: $this, however, only works directly within your controllers, your models, or your views. If you would like to use CodeIgniter's classes from within your own custom classes you can do so as follows: First, assign the CodeIgniter object to a variable:[php]$CI =& get_instance();[/php]Once you've assigned the object to a variable, you'll use that variable instead of $this: You'll notice that the above get_instance() function is being passed by reference: This is very important. Assigning by reference allows you to use the original CodeIgniter object rather than creating a copy…
The passage is telling you how to rename the file name automatically by WordPress (without using any plugins). Warning: To apply this hack, you'll have to edit one of WordPress's core files. Keep in mind that it is never recommended. This hack should be redone if you upgrade WordPress. open the wp-admin/includes/files.php file, and go to line 324 (approximately here). You'll see the following: Change it as follows: And the file you upload will automatically be renamed as 20130218180064x268c.ext.