我已经使用CodeIgniter一段时间了,我非常喜欢它.看起来我需要转移到Kohana,因为我的其他团队成员需要我们的代码才能最大限度地充分利用PHP5功能.问题是我们已经在CodeIgniter中编写了超过一半的项目.有没有人之前将代码从CodeIgniter转移到Kohana?它甚至可以做到,如果这样做需要多少努力?先感谢您!
更新:从abi noda的回答来看,我觉得我真的需要做很多代码重写,但是之前有人做过吗?也许有人可以给我一些链接?是的,我认为这是可能的,但我不知道它需要多长时间.我想我们将把这个项目保留为CodeIgniter,并在下一个项目到来时立即转移到Kohana.谢谢你的一切!
我在尝试将我的网站连接到Facebook时遇到问题.我想要做的是允许用户通过将他们连接到Facebook来增加他们的帐户(我不需要人们能够使用Facebook登录,我使用的是OpenID).我的网站运行在CodeIgniter框架中.
我要做的就是删除我尝试过的所有内容,然后引导你完成我的步骤直到它停止工作.
第1步:设置JavaScript SDK和XFBML
首先,我将FBML规范的引用添加到我的<html>标记中:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en">
Run Code Online (Sandbox Code Playgroud)
然后,在我的<body>标签之后,我添加:
<script src="http://static.new.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
现在我遇到了第一个问题但现在已经解决了.问题是JavaScript SDK的文档说该FB.init()方法需要appId作为参数,但结果证明这是不正确的.我需要通过我的apiKey.所以这是我最终得到的代码,它在我的</body>标记之前:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
apiKey : '<?php echo $this->config->item('facebook_api_key'); ?>',
status : true,
cookie : true,
xfbml : true
});
</script>
Run Code Online (Sandbox Code Playgroud)
现在我可以将XFBML实体添加到我的页面中,例如<fb:login-button></fb:login-button>它可以按预期工作.我点击它然后会弹出一个框,询问我是否允许我的网站访问我的Facebook个人资料.我说是的,然后如果我在Facebook上检查我的应用程序设置,我可以看到我的网站已被添加.
所以这一步很好.
第2步:设置PHP库
好的,现在我需要添加PHP库.因此,快速谷歌搜索'codeigniter facebook库'会显示Elliot Haughin的图书馆.我下载文件,将它们放在正确的位置,然后开始加载库.
现在出现了当前的问题.我将以下代码(取自库中给出的示例)添加到我的控制器构造函数中,以便它在每个页面上发生:
$this->load->library('facebook_connect');
$this->data['fb_user'] = $this->facebook_connect->user;
$this->data['fb_userid'] = $this->facebook_connect->user_id;
Run Code Online (Sandbox Code Playgroud)
但如果我这样做,print_r($this->data['fb_user']);我什么也得不到.永远.我是否登录Facebook,登出,登录并将我的网站添加到我的个人资料等等.用户和user_id永远不会设置.我没有收到任何错误.
据我所知,应该设置这些值,以便我知道浏览我网站的人是否登录了他们的Facebook帐户.如果他们是,我可以看看他们是否允许我的申请.如果他们允许,我可以让他们与我的网站断开连接,如果没有,我可以让他们连接.但如果没有填充这些变量,我就无法做任何事情.
我试过在图书馆的内容中探索,但我真的无法理解它.而且我希望实际的解决方案不会涉及将图书馆分开.我希望CodeIgniter特定的库可以工作.
有任何想法吗?
非常感谢.:)
我正在为我们的CodeIgniter应用程序构建一个库,但它需要很多类(目前我已经12岁了).
是否有将这些客户端打包到一个库中的最佳实践.所以我可以打一个电话加载它.即:
$this->load->library('soaplibrary');
Run Code Online (Sandbox Code Playgroud)
谢谢!
我正在使用CodeIgniter并且刚刚在Ubuntu 10.10云服务器上安装了LAMP堆栈.
一切都很好,我启用了Apache userdir模块,这样我的主目录就可以了/home/myapp/public_html,我可以通过访问它来访问它servername/~myapp.
不幸的是,.htaccess重写似乎没有起作用 - 它导致the file /home/myapp/public_html/index.php无法找到404说- 404错误.
Mod_rewrite已启用.
我知道你需要设置AllowOverride All指令 - 我已经设置了/etc/apache2/sites-enabled/default- 但重写似乎没有正常工作.
我的.htaccess文件只包含:
RewriteEngine on
RewriteCond $1 !^(index.php|img|stylesheets|js|icons|robots\.txt|user_guide)
RewriteRule ^(.*)$ index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud)
我/etc/apache2/sites-available/default看起来像:
<VirtualHost *:80>
ServerAdmin dan@danmatthews.me
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride ALL
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride ALL
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews …Run Code Online (Sandbox Code Playgroud) 这让我很困扰,因为随着我今天收到的 PHP Intelephense 的最新更新,intelephense 不断显示未知属性、函数的错误。
这是我的代码:
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Firm extends CI_Controller
{
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to …Run Code Online (Sandbox Code Playgroud) 是的,我知道一个是框架而另一个是CMS.
但是,我是一个为自己开发项目/网站的单人团队,我有足够的时间让这些项目开始,所以速度至关重要.
基本上我正在寻找最简单,最快速的创建Web应用程序的方法,而不受功能限制.
学习Codeigniter或构建Wordpress并开发自己的主题/插件是最好/最快的吗?可能另一种更可行的选择?
我经常处理视频/照片媒体和高流量网站.
谢谢!
我有一个用于日志记录的自定义助手.
在帮助程序的其中一个函数中,我需要获取被调用的控制器的名称.有办法吗?
我不能依赖uri段,因为一些控制器在子文件夹中,并且帮助器全部使用.
我正在使用TinyMCE <textarea>.我的要求是将字符大小限制为2000,并在工具栏下方的某处显示剩余的字符.我以某种方式设法获得了人物编号; 现在我不知道显示剩余的字符并防止超出限制.
这是我的TinyMCE代码
tinyMCE.init({
// General options
mode : "textareas",
theme : "simple",
plugins : "autolink,lists,pagebreak,style,table,save,advhr,advimage,
advlink,emotions,media,noneditable,visualchars,nonbreaking,
xhtmlxtras,template",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,
justifyleft,justifycenter,justifyright,
justifyfull,|,styleselect,formatselect,
fontselect,fontsizeselect",
theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,
link,unlink,anchor,image,code,|,forecolor,
backcolor",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
charLimit : 10, // this is a default value which can get modified later
setup : function(ed) {
//peform this action every time a key is pressed
ed.onKeyUp.add(function(ed, e) {
//define local variables
var …Run Code Online (Sandbox Code Playgroud) 我有点困惑,在代码点火器中使用库和助手的方法.我还在学习代码点火器.
CONTROLLER
function index(){
$this->load->helper('text');
$this->load->library('auth'); //custom library
$data['string'] = 'this is sample ..... this is sample';
$this->load->view('article', $data);
}
Run Code Online (Sandbox Code Playgroud)
视图
<?php
if(is_logged_in()){ //is_logged_in() is the method from the library, 'auth'
echo 'You are logged in';
}
<p><?php echo word_limiter($string, 10); ?></p> <!--word_limiter() is the method from the helper, 'text' -->
Run Code Online (Sandbox Code Playgroud)
在上面的视图文件中,帮助方法word_limiter()工作正常.但该方法is_logged_in()不起作用.但如果我这样做($this->auth->is_logged_in()),它会起作用.
但是为什么来自helper的方法word_limiter()不必像这样写($this->text->word_limiter()).
调用helper和library的方法有什么区别吗?
codeigniter ×10
php ×5
javascript ×2
apache ×1
driver ×1
facebook ×1
frameworks ×1
inheritance ×1
intelephense ×1
kohana ×1
laravel ×1
libraries ×1
maxlength ×1
migration ×1
textarea ×1
tinymce ×1
ubuntu ×1
wordpress ×1