Code Solution

Category

7 posts found

31 Mar 2019
1.33K
No Comments

I’ve wrote add_subdomain_in_url function and it will help you in easily add sub domain in url by passing in parameters and look output result. [php] function add_subdomain_in_url($url,$subdomain){ $www_pos = strpos($url,’www.’); $non_www_pos = strpos($url,’://’); if($www_pos!==false){ return substr($url,0, $www_pos+4).$subdomain.’.’.substr($url,$www_pos+4); } else if($non_www_pos!==false){ return substr($url,0, $non_www_pos+3).$subdomain.’.’.substr($url,$non_www_pos+3); } else { return $subdomain.’.’.$url; } }

Post in

17 Mar 2019
3.12K
No Comments

New version 7.2 of PHP is little bit restrict for calling functions and passing parameters, now count() function will only count variable and it will thrown an error when parameter is not array. Here is quick fix I have create my own function for counting array or object and it

Post in

10 Jul 2018
0.51K
No Comments

I need that function to delete 10 minutes old files from my project, remove_x_minutes_old_files function required two parameters $path for directory path and $in_minutes for minutes how much old file you want to delete. [php] function remove_x_minutes_old_files($path,$in_minutes=10){ $minutes_in_seconds = $in_minutes*60; $now_unix_time = strtotime(‘now’); $d2 = array(‘.’,’..’); $dirs = array_diff(scandir($path),$d2); foreach($dirs

Post in

29 Dec 2017
0.81K
No Comments

This function I was made specially for my theme which is running in this blog. I made function because Gravatar generate random images on each user’s avatar if user not uploaded real image, this function will not work no localhost so please use domain path eg: domain.com/wp-content/themes/mytheme/images/DefaultAvatar.jpg [php] function getavatar_src($author_idOrEMAIL=0,$size=50){

Post in

23 Feb 2017
0.29K
No Comments

This is happens to me and #valcatohosting allowed to use free #HTTPS #SSL  for website Other mostly #hosting companies are providing free for #SSL #wordpress websites only [javascript] <IfModule mod_rewrite.c> RewriteEngine On #for to https – END code RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] #for to https – END

Post in

1 Feb 2017
0.45K
No Comments

Most this error occurred when you forget to add csrf_token field in form tag and  in #laravel 5+ csrf_token field will be automatically when you call Form::open call following code for .blade template [php] {!! Form::hidden(‘_token’, csrf_token()) !!} [/php] call following code for non .blade template. [html] <input type="hidden" value="{{csrf_token()}}"

Post in

31 Jan 2017
1.67K
No Comments

maximum execution error occurred most in longest executions in #php and #laravel is also written in #php. so if this maximum execution error occurred in #laravel framework and you just want increase seconds of max execution so put this code after <?php in laravel controller file see example code. [php]

Post in