php

Trailing %20 white space in URLs producing 404 errors in Codeigniter

老子叫甜甜 提交于 2021-02-19 07:16:23
问题 Our URLs with a URL encoded trailing white space ( %20 ) are producing a 404 error. The application is run on Codeigniter on Apache. /directory/page%20 will return a 404 error /directory/page will return a 200 OK How can I route all URLs with a trailing %20 to the intended URL? 回答1: The problem is that some third party websites are linking to us with trailing white space in the HREF In that case you can add something like the following at the top of your .htaccess file to redirect

How to upload a file via ftp in PHP?

為{幸葍}努か 提交于 2021-02-19 07:15:44
问题 I have a form with html browse type and a submit button. I chose a file using browse button and submit the form. On form submission following code is called. $conn_id="myid"; $conn_id = ftp_connect ( 'server' ); $ftp_user_name="username"; $ftp_user_pass="password"; // login with username and password $login_result = ftp_login ( $conn_id , $ftp_user_name , $ftp_user_pass ); // check connection if ((! $conn_id ) || (! $login_result )) { echo "FTP connection has failed!" ; exit; } else { echo

How to upload a file via ftp in PHP?

懵懂的女人 提交于 2021-02-19 07:14:17
问题 I have a form with html browse type and a submit button. I chose a file using browse button and submit the form. On form submission following code is called. $conn_id="myid"; $conn_id = ftp_connect ( 'server' ); $ftp_user_name="username"; $ftp_user_pass="password"; // login with username and password $login_result = ftp_login ( $conn_id , $ftp_user_name , $ftp_user_pass ); // check connection if ((! $conn_id ) || (! $login_result )) { echo "FTP connection has failed!" ; exit; } else { echo

Laravel Eloquent object, longtext being truncated

做~自己de王妃 提交于 2021-02-19 07:12:58
问题 I've using Laravel, loading a db row into an Eloquent object. One of the columns is longtext, a JSON encoded array > 2 million characters long. The original error I was getting was json_decode failing on this column's value. I tested in tinker. Simplified test code: $item = Item::find(1); echo $item->long_text_field; var_dump(json_decode($item->long_text_field)); echo strlen($item->long_text_field); On my local vagrant instance this shows the correct values. ...long json array in text, same

Laravel Eloquent object, longtext being truncated

主宰稳场 提交于 2021-02-19 07:12:39
问题 I've using Laravel, loading a db row into an Eloquent object. One of the columns is longtext, a JSON encoded array > 2 million characters long. The original error I was getting was json_decode failing on this column's value. I tested in tinker. Simplified test code: $item = Item::find(1); echo $item->long_text_field; var_dump(json_decode($item->long_text_field)); echo strlen($item->long_text_field); On my local vagrant instance this shows the correct values. ...long json array in text, same

No PostgreSQL link opened yet

邮差的信 提交于 2021-02-19 07:06:27
问题 I am completly new to databases and am trying to make a simple query to a postgreSQL database. Now the problem is that I don't really understand how things work. In my index.php I do $dbconn = pg_connect("host=myhost port=5432 dbname=mydbname user=myuser password=mypass sslmode=require options='--client_encoding=UTF8'") or die('Could not connect: ' . pg_last_error()); And I am connected to the database. When I try to query it from another myphp.php $query = "INSERT INTO public.account_recover

Woocommerce Change shipping method title on checkout based on shipping class selected

懵懂的女人 提交于 2021-02-19 06:52:04
问题 I want to change the shipping method title displayed in the checkout of my store based on the shipping class the product has. e.g. Shipping method title is currently Flat Rate and I have 2 products: If product A is being purchased I need it to have "Fragile shipping" If product B is being purchased I need it to have "Standard shipping" Sadly I have to do my shipping using classes so alternative methods won't work. Any help would be appreciated. 回答1: The following code will rename your

Change Related Products Heading adding the product name in WooCommerce

自闭症网瘾萝莉.ら 提交于 2021-02-19 06:48:04
问题 I have this code which is an attempt in translating "Related products" into "These will go well with PRODUCT NAME". Here's my code: add_filter( 'gettext', 'change_related_products_title', 10, 3 ); function change_related_products_title( $translated, $text, $domain ) { $ptitle = get_page_by_title( 'Product Title', OBJECT, 'product' ); if( $text === 'Related products' && $domain === 'woocommerce' ){ $translated = esc_html__( 'These go well with '.$ptitle.' ', $domain); } return $translated; }

$.post to Codeigniter Controller/Method 404 Page Not Found

为君一笑 提交于 2021-02-19 06:46:07
问题 I have developed a Codeigniter prototype application and hosted with Godaddy.com during the development phase for testing purposes without issue. This application uses a combination of javascript, jquery, HTML5, CSS and PHP (Codeigniter Framework). This week I have transferred the application to the clients server and have had many configuration issues but finally hit a wall. The client set up a fresh install on a new Linux/Apache2 server with PHP5. mod_rewrite is enabled and allowoverride is

Laravel with datatables: searching encrypted data

南楼画角 提交于 2021-02-19 06:26:06
问题 I have encountered a great issue while using Laravel's datatables. I have a model that has 3 values automatically encrypted (using Crypt) by setter/getter. I am using datatables to render a table by doing so: return datatables()->of(Patient::query()) ->addColumn('name_surname', function($row){ return $row->name.' '.$row->surname; }) ->make(true); There is 3 ways to pass a model to datatable: by query (Patient::query()) by collection (Patient::all()) by DB facade The third doesnt decrypt data.