codeigniter

How to convert .wav to .mp3 file in php

萝らか妹 提交于 2019-12-29 08:49:30
问题 I am currently developing a website using the CodeIgniter framework and in one of the Process I need to download a .wav music file and convert it to .mp3 file. All the coding needs to be done only in PHP and I cannot use Ruby or java to do so. And I am currently hosting on a shared env i.e. Dreamhost. So please let me know how to work out this problem. 回答1: Use FFMPEG. There is a PHP extension for it, but I've found better success just calling exec() . Most hosts I have used (even shared

CodeIgniter - Call method inside a model?

你说的曾经没有我的故事 提交于 2019-12-29 08:40:08
问题 I have the following code: class Badge extends CI_Model { public function foo() { echo $this->bar('world'); } public function bar($word) { return $word; } } But it always gives me an error on the line where echo $this->bar('world'); is. Call to undefined method (......) 回答1: Your not loading your model inside your controller: public function test() { $this->load->model('badge'); $this->badge->foo(); } Because the code works - I've just tested it by pasting using your model unedited: class

creating a core class that extends another core class codeigniter [duplicate]

こ雲淡風輕ζ 提交于 2019-12-29 08:23:42
问题 This question already has answers here : Codeigniter extending extended MY_Controller (5 answers) Closed 5 years ago . class Settings extends USER_Controller {...} class USER_Controller extends MY_Controller {...}//limit access to user and define some params and functions that is user depended class MY_Controller extends CI_Controller {...}//provide extra functionality accross all controllers well if i try to create above 3 class's this will not work. yet if i just use settings extends MY

Display “time ago” instead of datetime in PHP Codeigniter

偶尔善良 提交于 2019-12-29 08:15:14
问题 I would like to display a time format like twitter and FB (Posted 3 hours ago, Posted 2 minutes ago and so on...) I've tried this piece of code without success : function format_interval($timestamp, $granularity = 2) { $units = array('1 year|@count years' => 31536000, '1 week|@count weeks' => 604800, '1 day|@count days' => 86400, '1 hour|@count hours' => 3600, '1 min|@count min' => 60, '1 sec|@count sec' => 1); $output = ''; foreach ($units as $key => $value) { $key = explode('|', $key); if (

CodeIgniter .htaccess - 500 Internal Server Error/ index.php remove

拜拜、爱过 提交于 2019-12-29 08:15:07
问题 I have a website like this (sub-domain) rabbani.websolocom.xyz And I have the .htaccess code like this (I used Codeigniter) : RewriteEngine on RewriteBase /rabbani RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-D RewriteRule ^(.*)$ index.php/$1 [L,QSA] But when I try to access my website it goes error (500 Internal Server Error). What should i do with my .htaccess file? Or any another file that wrong in my directory?

Connecting to a remote database through CodeIgniter

最后都变了- 提交于 2019-12-29 06:57:06
问题 Unable to connect to your database server using the provided settings. I've been having difficulty connecting my application to my remote database. I'm receiving the error shown above when I run my application. I've looked at previous answers to this question on this site, but I've gotten no luck at solving it. From what I learnt, I need to replace the hostname and make my mysql database accept external connections, which I have both done. I tried the same values in my database.php through

Codeigniter: Weird behaviour of $this->db->like()

白昼怎懂夜的黑 提交于 2019-12-29 06:48:11
问题 I've written a simple query for searching a keyword in the database. $keyword = "keyword sample"; $keyword = str_replace(" ", "%", $keyword); $this->db->select('*')->from('table') ->like('column', "%".$keyword."%")->get(); Now the query generated by Codeigniter is like this: SELECT * FROM (`table`) WHERE `column` LIKE '%keyword\%sample%' Where is the trailing \ coming from in the query? This is making an erroneous search and not returning the data that is actually in the db. I've checked

SQL query escaping + codeigniter

南楼画角 提交于 2019-12-29 06:25:18
问题 I'm using codeigniter and most of the time use active record for my queries (which automatically escapes them), but this query doesn't seem to fit neatly into it because of the variable. So I need to figure out how to escape the query manually. Codeigniter docs suggest escaping the queries this way: $sql = "INSERT INTO table (title) VALUES(".$this->db->escape($title).")"; My original query $sql = "SELECT * FROM (`user_language`) WHERE `user_id` = '{$id}'"; My escaped query $sql = "SELECT *

CodeIgniter & DBForge - Create Database and Tables

那年仲夏 提交于 2019-12-29 06:24:13
问题 I'm trying to write a script in CodeIgniter that will create a database and then will add tables to that newly created database along with various fields in to the new table. So far I've got dbforge to create the new database but since I'm using the database library and have pre-set database connection values, when it goes to create a table, it puts it in the pre-selected database and not the one it just created. In the database.php config file I have the following: $db['default']['database']

CodeIgniter & DBForge - Create Database and Tables

最后都变了- 提交于 2019-12-29 06:22:09
问题 I'm trying to write a script in CodeIgniter that will create a database and then will add tables to that newly created database along with various fields in to the new table. So far I've got dbforge to create the new database but since I'm using the database library and have pre-set database connection values, when it goes to create a table, it puts it in the pre-selected database and not the one it just created. In the database.php config file I have the following: $db['default']['database']