灯角

文章 0 评论 0 浏览 23

灯角 2024-10-16 00:38:01

确保您正在编辑您认为正在编辑的配置文件。看一下下面的代码

#File: app/code/core/Mage/Core/Model/Config.php

public function loadBase()
{
    $etcDir = $this->getOptions()->getEtcDir();
    $files = glob($etcDir.DS.'*.xml');
    $this->loadFile(current($files));
    while ($file = next($files)) {
        $merge = clone $this->_prototype;
        $merge->loadFile($file);
        $this->extend($merge);
    }
    if (in_array($etcDir.DS.'local.xml', $files)) {
        $this->_isLocalConfigLoaded = true;
    }
    return $this;
}

这是将 local.xml 文件合并到配置树的代码。添加一些调试代码

public function loadBase()
{
    var_dump('Called ' . __METHOD__);   //ensure we're being called    
    $etcDir = $this->getOptions()->getEtcDir();
    $files = glob($etcDir.DS.'*.xml');
    $this->loadFile(current($files));
    while ($file = next($files)) {
        var_dump($file);                    //dump the file path being loaded to the browser
        $merge = clone $this->_prototype;
        $merge->loadFile($file);
        $this->extend($merge);
    }
    if (in_array($etcDir.DS.'local.xml', $files)) {
        $this->_isLocalConfigLoaded = true;
    }
    exit;                                   //bail out early
    return $this;
}

在浏览器中加载您的站点,并观察通过 var_dump 输出的路径。确保正在加载的文件是您认为正在加载的文件。请记住,它看起来像是 etc 文件夹中的每个 XML 文件都已加载并合并。

如果路径符合您的预期,接下来添加一些调试代码以输出 XML 文件的内容) 正在加载。

public function loadBase()
{
    var_dump('Called ' . __METHOD__ . '');  //ensure we're being called    
    $etcDir = $this->getOptions()->getEtcDir();
    $files = glob($etcDir.DS.'*.xml');
    $this->loadFile(current($files));
    while ($file = next($files)) {
        header('Content-Type: text/plain'); //so the browser renders it as plain text
        echo file_get_contents($file);      //dump the contents of the file being loaded to the browser
        $merge = clone $this->_prototype;
        $merge->loadFile($file);
        $this->extend($merge);
    }
    if (in_array($etcDir.DS.'local.xml', $files)) {
        $this->_isLocalConfigLoaded = true;
    }
    exit;                                   //bail out early
    return $this;
}

如果这些文件中的数据库信息是正确的,那么您的系统已经被定制和/或以某种方式被黑客攻击,有代码调用另一个数据库服务器。

如果是这种情况,您需要安装 xDebug 之类的东西才能获得一些不错的错误报告。这将使您找到引发错误的确切代码,此时您可以追溯到它获取连接信息的位置。

祝你好运。

Make sure you're editing the config file you think you're editing. Take a look at the following code

#File: app/code/core/Mage/Core/Model/Config.php

public function loadBase()
{
    $etcDir = $this->getOptions()->getEtcDir();
    $files = glob($etcDir.DS.'*.xml');
    $this->loadFile(current($files));
    while ($file = next($files)) {
        $merge = clone $this->_prototype;
        $merge->loadFile($file);
        $this->extend($merge);
    }
    if (in_array($etcDir.DS.'local.xml', $files)) {
        $this->_isLocalConfigLoaded = true;
    }
    return $this;
}

This is the code that merges in your local.xml file to the configuration tree. Add some debugging code

public function loadBase()
{
    var_dump('Called ' . __METHOD__);   //ensure we're being called    
    $etcDir = $this->getOptions()->getEtcDir();
    $files = glob($etcDir.DS.'*.xml');
    $this->loadFile(current($files));
    while ($file = next($files)) {
        var_dump($file);                    //dump the file path being loaded to the browser
        $merge = clone $this->_prototype;
        $merge->loadFile($file);
        $this->extend($merge);
    }
    if (in_array($etcDir.DS.'local.xml', $files)) {
        $this->_isLocalConfigLoaded = true;
    }
    exit;                                   //bail out early
    return $this;
}

Load your site in a browser, and observe the paths being output via var_dump. Make sure that the file(s) being loaded are the ones you think are being loaded. Keep in mind that it looks like every XML file from the etc folder is loaded and merged in.

If the paths are what you expect, next add some debugging code to output the contents of the XML file(s) being loaded.

public function loadBase()
{
    var_dump('Called ' . __METHOD__ . '');  //ensure we're being called    
    $etcDir = $this->getOptions()->getEtcDir();
    $files = glob($etcDir.DS.'*.xml');
    $this->loadFile(current($files));
    while ($file = next($files)) {
        header('Content-Type: text/plain'); //so the browser renders it as plain text
        echo file_get_contents($file);      //dump the contents of the file being loaded to the browser
        $merge = clone $this->_prototype;
        $merge->loadFile($file);
        $this->extend($merge);
    }
    if (in_array($etcDir.DS.'local.xml', $files)) {
        $this->_isLocalConfigLoaded = true;
    }
    exit;                                   //bail out early
    return $this;
}

If the database information is correct in these files, then your system has been customized and/or hacked in some way that there's code calling out to another database server.

If that's the case you'll need to install something like xDebug to get some decent error reporting. This will let you find the exact code that's throwing the error, at which point you can trace it back to where it's getting it's connection information.

Good luck.

Magento 实例指向错误的数据库

灯角 2024-10-15 20:12:05

除非我弄错了,否则你只会遇到第三个查询的问题;前两个查询运行良好。对于第三个查询(总结最后两条记录的成本),您可以按降序对结果集进行排序,并将其限制为两条记录。

Unless I got you wrong, you only have problems with the third query; the first two queries are working well. For the third query (summing up the costs of the last two records), you could sort the result set in descending order and limit it to two records.

Mysql 查询使用 SUM 和 Limit 计算使用量和成本

灯角 2024-10-15 19:52:13

get_ip() 是如何工作的?

如果 nginx 是反向代理,gunicorn 是应用程序服务器,则它始终从本地计算机上的 nginx 获取请求。

在我的例子中,nginx 发送到应用程序服务器的真实 IP 是通过 nginx conf 行 HTTP_X_REAL_IP proxy_set_header X-Real-IP $remote_addr;

所以你可能想要设置它,并在您的 django 应用帐户中使用新的 IP 标头或设置 request.META['REMOTE_ADDR'] = request.META['HTTP_X_REAL_IP']

How does get_ip() work?

If nginx is a reverse proxy and gunicorn is the app server, it's always getting requests from nginx on the local machine.

The real ip that nginx sends to the app server is in my case HTTP_X_REAL_IP via the nginx conf line proxy_set_header X-Real-IP $remote_addr;

So you might want to set that, and in your django app account for the different header by either using your new IP header or set request.META['REMOTE_ADDR'] = request.META['HTTP_X_REAL_IP']

Django获取IP仅返回127.0.0.1

灯角 2024-10-15 18:38:47

正如 Jim 所说,UIKit 元素的源代码不可用,因为它不是开源的。
但是,如果您正在搜索显示如何使用它们的源代码,您可以在 开发者网站
UICatalog源代码就是您要找的。
它展示了如何使用最常见的 UIKit 元素,如按钮、选择器、警报和其他......

As Jim said, the source code ad an UIKit element is not available because it isn't open source.
But if you are searching for source code that show how to use them, you can search on the Developer Site.
UICatalog source code is what are you looking for.
It shows how to use the most common UIKit's element, like buttons, pickers, alerts and other...

ios4的UIDatePicker源码在哪里可以找到

灯角 2024-10-15 18:37:24

如果您确实不喜欢 Boost asio,那么您可能会喜欢 dlib 中的套接字支持。它更简单,因为它使用传统的阻塞 IO 和线程,而不是 asio 的异步前摄器模式。例如,它可以轻松创建一个从 iostream 读取和写入的线程 TCP 服务器。例如,请参阅此示例。或者,如果不充当服务器,您可以制作一个简单的 iosockstream

If you really don't like Boost asio then you might like the sockets support in dlib. It is simpler in the sense that it uses traditional blocking IO and threads rather than asio's asynchronous proactor pattern. For example, it makes it easy to make a threaded TCP server that reads and writes from the iostreams. See this example for instance. Or you can just make a simple iosockstream if not acting as a server.

便携式轻型 C++套接字包装器

灯角 2024-10-15 15:39:15

XAML 页面无法显示在浏览器窗口中。 Silverlight 实际上所做的就是在 << 中显示 Silverlight 程序。对象> aspx(或html)页面中的标记;而已。

在您的 silverlight 项目中,如果您选择在新网站中托管您的项目,您将看到第二个项目,其中包含 htm 和 aspx 文件,该文件托管链接到您的 xap 文件的对象。

因此基本上,您需要创建第二个 Silverlight 项目,该项目将托管在不同的 aspx 页面中。然后,在您的主 silverlight 项目中,您可以在新的 Web 浏览器窗口中打开该新的 aspx 页面。

a XAML page cannot be shown in a browser window. What Silverlight do actually is showing the Silverlight program within an < object > tag in the aspx (or html) page; nothing more.

In your silverlight project, if you chose to host your project in a new web site, you will see a second project with both a htm and aspx file that hosts that object that links to your xap file.

So basically, you need to create a second Silverlight project that will be hosted in a different aspx page. Then in your main silverlight project your can open that new aspx page in a new web browser window.

silverlight - 在新的网络浏览器中打开 xaml

灯角 2024-10-15 13:38:26

您确实需要提供广告,这是由苹果服务选择的。

You do need provide ad, it is chosen by apple service.

在iPhone和iPad SDK中使用iAds时,我们是否必须提供广告?

灯角 2024-10-15 13:06:24

在深入研究代码并进行操作之后,我找到了一种方法来做到这一点,无论您在哪里获得框架,该方法都可能记录在案。

查看 iCodeOauthViewController.m,在 viewDidAppear: 内部,您可以在引擎上调用 isAuthorized,它会告诉您是否已通过身份验证。如果返回 yes,您可以调用引擎对象上的 clearAccessToken 方法来清除该身份验证。当接下来调用 controllerToEnterCredentialsWithTwitterEngine: delegate: 时,它将返回视图控制器以重新输入用户名和密码。

编辑:
在 iCodeOauthViewController.m 内的 fo viewDidAppear: (line 46) 中,您将看到这一行:

UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self];

如果用户尚未登录,此调用将返回您看到的登录屏幕。如果用户已登录,则返回 nil。如果控制器为零,则直接跳转到列表。

要“注销”用户,您可以使用此方法:

- (void)switchUser
{
    // log off the existing user if one is validated
    if ([_engine isAuthorized])
        [_engine clearAccessToken];

    // display the login prompt
    UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self];       
    if (controller) 
        [self presentModalViewController: controller animated: YES];
}

编辑2:
看来您的问题出在您的 tweet 方法内部。您已在推文尝试发送后添加了警报代码,如果用户未登录,这会导致崩溃。这是您的代码:

-(IBAction)tweet:(id)sender {

    [textfield resignFirstResponder];
    [_engine sendUpdate:[textfield text]];
    [self updateStream:nil];


    if([_engine isAuthorized]==NO){UIAlertView *alert = [[UIAlertView alloc]
                                                         initWithTitle: @"Please, Sign in"
                                                         message: @"You'll have to sign in for this app to work!"
                                                         delegate: nil
                                                         cancelButtonTitle:@"Ok"
                                                         otherButtonTitles:nil];
        [alert show];
        [alert release];
        }
}

将其更改为如下所示:

-(IBAction)tweet:(id)sender {


if([_engine isAuthorized]==NO){
    UIAlertView *alert = [[UIAlertView alloc]
                                                     initWithTitle: @"Please, Sign in"
                                                     message: @"You'll have to sign in for this app to work!"
                                                     delegate: nil
                                                     cancelButtonTitle:@"Ok"
                                                     otherButtonTitles:nil];
    [alert show];
    [alert release];
    }
else {
    [textfield resignFirstResponder];
    [_engine sendUpdate:[textfield text]];
    [self updateStream:nil];

}

}

请注意,我们现在检查是否我们在尝试发送推文之前经过身份验证,如果我们未获得授权,则会弹出警报。抱歉,我可能在发布警报的事情上误导了您,我误解了您的意思。

我建议尝试更多地了解 Objective-C 的工作原理并获取 熟悉调试器。如果您运行调试器并且您的应用程序崩溃,调试器将在崩溃的代码中停止,您可以查看堆栈中的函数调用以确定代码做错了什么。请参阅此堆栈溢出问题(具体是答案),了解有关如何更好地开始使用 Objective-C。我会推荐一些在线网站,例如 CocoaDevCentral 教程。 记住这一点。您已经有了一个良好的开端,尝试根据示例制作自己的东西。如果一个想法不能立即在你的主项目中实现,不要害怕做一个副项目来尝试它,即使它像找出另一种方法来完成 2 + 2 一样简单。希望这会有所帮助。

After digging into the code and playing with things I found a way to do this that is probably documented wherever you got the framework.

Looking at iCodeOauthViewController.m, inside of viewDidAppear: you can call isAuthorized on the engine and it will tell you if you are authenticated or not. If this returns yes, you can then call the clearAccessToken method on the engine object to clear that authentication. When controllerToEnterCredentialsWithTwitterEngine: delegate: is next called it will return the view controller for re-entering the user name and password.

edit:
in iCodeOauthViewController.m inside fo viewDidAppear: (line 46) you will see this line:

UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self];

this call returns the login screen that you see if the user is not yet logged in. If the user is logged in, it returns nil. If the controller is nil it jumps directly to the list.

to "log out" a user you could use this method:

- (void)switchUser
{
    // log off the existing user if one is validated
    if ([_engine isAuthorized])
        [_engine clearAccessToken];

    // display the login prompt
    UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self];       
    if (controller) 
        [self presentModalViewController: controller animated: YES];
}

edit 2:
Looks like your problem is inside of your tweet method. You have added the alert code after the tweet attempts to send, and that results in a crash if the user isn't logged in. Here is your code:

-(IBAction)tweet:(id)sender {

    [textfield resignFirstResponder];
    [_engine sendUpdate:[textfield text]];
    [self updateStream:nil];


    if([_engine isAuthorized]==NO){UIAlertView *alert = [[UIAlertView alloc]
                                                         initWithTitle: @"Please, Sign in"
                                                         message: @"You'll have to sign in for this app to work!"
                                                         delegate: nil
                                                         cancelButtonTitle:@"Ok"
                                                         otherButtonTitles:nil];
        [alert show];
        [alert release];
        }
}

change it to look like this:

-(IBAction)tweet:(id)sender {


if([_engine isAuthorized]==NO){
    UIAlertView *alert = [[UIAlertView alloc]
                                                     initWithTitle: @"Please, Sign in"
                                                     message: @"You'll have to sign in for this app to work!"
                                                     delegate: nil
                                                     cancelButtonTitle:@"Ok"
                                                     otherButtonTitles:nil];
    [alert show];
    [alert release];
    }
else {
    [textfield resignFirstResponder];
    [_engine sendUpdate:[textfield text]];
    [self updateStream:nil];

}

}

Notice that we now check to see if we are authenticated before trying to send the tweet, and if we are not authorized then pop up an alert instead. My apologies, I may have misled you with the releasing the alert thing, I misunderstood what you were saying.

I would recommend trying to understand a little more about how objective-c works and get familiar with the debugger. If you run the debugger and your app is crashing, the debugger will stop at the point in the code that is crashing, and you can look through the function calls in the stack to determine what the code is doing wrong. See this stack overflow question (specifically the answers) for more resources on how to get a better start with objective-c. I would recommend some of the online sites like CocoaDevCentral's tutorials. Remember this. You're off to a good start trying to make something your own based on an example. Don't be afraid to make a side project to play around with an idea if it's not immediately working out in your main project, even if it's something as simple as figuring out another way to do 2 + 2. Hope that helps.

oAuth/MGTwitterEngine 更改 iPhone 的用户?

灯角 2024-10-15 10:47:03

将其添加到您的代码中(可能在 onCreate 中)

//textView.setMovementMethod(ScrollingMovementMethod.getInstance()); 
tv_service_ticketinfo_details.setMovementMethod(ScrollingMovementMethod.getInstance()); 

并进行测试。

add this in your code(may be in onCreate)

//textView.setMovementMethod(ScrollingMovementMethod.getInstance()); 
tv_service_ticketinfo_details.setMovementMethod(ScrollingMovementMethod.getInstance()); 

and test.

TextView 中的滚动条

灯角 2024-10-15 09:31:28

您的许多具体问题都取决于实施。

SQL 查询是声明性的。他们没有指定获得答案的方式,只是表明您正在寻找什么。 DMBS(数据库管理系统)决定如何将这些付诸实践。大多数 SELECT 查询都包含某种类型的表扫描迭代(除非通过相关字段上的索引克服了这一点),但您在查询中间看不到显式循环。

我可以明确建议您的是,如果您对总和的实际值不感兴趣,则不要使用总和等聚合函数。如果您想要获取在任何行的这三个字段中的任何一个中具有正值的 UserId,请使用 DISTINCT。这至少让 DMBS 有机会做正确的事情并优化该查询。

索引可能对这个查询有帮助,但作用不大。索引真正有用的地方是在不同的表之间进行等式连接(当您将具有 m 行的表与具有 n 行的表进行等连接时,这可能需要 m*n 时间)。在这里,您要做的就是过滤,只要这 3 个字段之一为正。在最坏的情况下,您将每行查看一次。 UserId 上的索引与 DISTNCT 结合使用可以帮助排除您已决定包含的用户的检查行。

A lot of your specific questions are implementation dependent.

SQL queries are declarative. They do not specify the means of obtaining the answer, they just indicate what you are looking for. The DMBS (database management system) determines how these are put into practice. Most SELECT queries contain some type of table-scanning iteration (unless this is overcome by an index on the field in question), but you don't see looping explicitly in the middle of the query.

What I can recommend to you definitively is that you do not use aggregate functions such as sums if you are not interested in the actual values of the sums. Use DISTINCT if what you want is to get those UserIds that have positive values in any of those three fields in any row. This at least gives the DMBS a chance to do the right thing and optimize that query.

It is possible that index could help this query, but not that substantially. Where indexing really helps is doing things like equality joins across different tables (this could involve m*n time when you equi-join a table with m rows to a table with n). Here all you want to do is filter so long as one of those 3 fields is positive. You will, worst-case, look at every row once. An index on UserId could help, in conjunction with DISTNCT, to exclude checking rows with a User that you've already decided to include.

数据库行为 HAVING-SUM 与 WHERE / DISTINCT 与 GROUP BY

灯角 2024-10-15 07:52:22
  1. 切勿依赖算法的保密性,因为它只会给您带来错误的安全感。 Wiki:隐匿性安全
  2. 请记住,浏览器是我的计算机上的一个程序我是对发送给您的内容拥有完全控制权的人,而不是我的浏览器。
  3. 我想 Firebug 等开发人员工具将提供一些用于浏览 WebSocket 发送/接收的数据的奇特工具,这只是时间问题(在我看来最多几个月)。
  1. Never rely on secrecy of algorithm cause it only gives you false sense of security. Wiki: Security by obscurity
  2. Remember that browser is a program on my computer and I am the one who have a full control over what is send to you, not my browser.
  3. I guess it's only matter of time (up to few months IMO) when developer tools such as Firebug will provide some fancy tool for browsing data send/received by WebSockets.

Websocket 对于网页之间的通信是否更安全?

灯角 2024-10-15 06:16:58

您可以将该方法作为构造函数的最后一行调用。

或者,如果您没有该课程,您可以选择面向方面编程(http://en.wikipedia。 org/wiki/Aspect_oriented_programming

You can just call the method as the last line of the constructor.

Alternatively if you don't own the class you can go for Aspect Oriented Programming ( http://en.wikipedia.org/wiki/Aspect_oriented_programming )

如何在构造函数完成后立即调用方法?

灯角 2024-10-15 06:12:49

关于底部的黑线是因为你没有处理长宽比。

double aspectRatio = imageWidth/imageHeight;
double boxRatio = maxWidth/maxHeight;
double scaleFactor = 0;
if (boxRatio > aspectRatio)
 //Use height, since that is the most restrictive dimension of box.
 scaleFactor = maxHeight / imageHeight;
else
 scaleFactor = maxWidth / imageWidth;

double newWidth = imageWidth * scaleFactor;
double newHeight = imageHeight * scaleFactor;

来源:http://nathanaeljones.com/163/20-image-resizing-pitfalls/

Regarding the black lines in the bottom is because you don't handle the Aspect Ratio.

double aspectRatio = imageWidth/imageHeight;
double boxRatio = maxWidth/maxHeight;
double scaleFactor = 0;
if (boxRatio > aspectRatio)
 //Use height, since that is the most restrictive dimension of box.
 scaleFactor = maxHeight / imageHeight;
else
 scaleFactor = maxWidth / imageWidth;

double newWidth = imageWidth * scaleFactor;
double newHeight = imageHeight * scaleFactor;

Source: http://nathanaeljones.com/163/20-image-resizing-pitfalls/

调整大小后图像周围出现幽灵般的轮廓

灯角 2024-10-15 03:20:19

OpenGL ES 1.1 没有专用的拾取功能。你必须构建自己的系统才能做到这一点。

OpenGL ES 1.1 has no dedicated picking functionality. You have to construct your own system to do it.

如何在 OpenGL ES 1.1 中选择单个三角形?

灯角 2024-10-15 01:43:04

根据原始问题中更新的代码进行更新

请记住,CodeIgniter 的 Hooks 类是在 Loader 类之前初始化的,因此您的 pre_controller 钩子正在实例化SiteObj 并尝试在通过 Loader 类加载 Site_model 之前调用 Site_model->create_site()

它会抛出错误,因为您无法在尚不存在的对象上调用方法。在本例中,Site_model 是尚不存在的对象。

请记住,您可以检查日志文件(位于 /system/logs/ 中)以查看资源的执行顺序。查看 CodeIgniter 应用程序流程图也可能会有所帮助。

希望有帮助!

结束更新

num_rows() 方法只能用于整个 $query 结果对象,就像您在您的 Site_model

$query = $this->db->query("SELECT * FROM sites WHERE siteid = '1' LIMIT 1");

if ($query->num_rows() > 0) {
        // do stuff
}

但是,目前 Site_model 中的 create_site() 方法返回单行return $row;) 从结果对象中调用,然后您尝试在 SiteObj 控制器中的该单行上调用 num_rows()

实际上没有必要这样做,因为 $query->row(); 将始终返回单个结果行。

如果您确实想从控制器内部调用 num_rows() (同样,这确实没有意义,因为 $query->row() 总是只返回一行),您必须像这样返回整个 $query 结果对象:

$query = $this->db->query("SELECT * FROM sites WHERE siteid = '1' LIMIT 1");

if ($query->num_rows() > 0) {
    return $query;
}

然后在您的 SiteObj 控制器中:

$this->load->model('Site_model');

$data = $this->Site_model->create_site();

if ($data->num_rows() == 1) {
    //etc. etc.
}

希望有帮助 - 如果没有请告诉我。看起来你的代码并不太遥远!作为参考,请查看 num_rows() 方法row() 方法

Update based on updated code in original question:

Keep in mind that CodeIgniter's Hooks Class is initialized before the Loader Class, so your pre_controller hook is instantiating SiteObj and trying to call Site_model->create_site() before Site_model has been loaded via the Loader Class.

It's throwing an error because you can't call a method on an object that doesn't exist yet. In this case Site_model is the object that doesn't exist yet.

Remember that you can check your log files (located in /system/logs/) to see the order in which resources are executed. It might also be helpful to review the CodeIgniter Application Flow Chart.

Hope that helps!

End Update

The num_rows() method can only be used on the entire $query result object like you have in your Site_model:

$query = $this->db->query("SELECT * FROM sites WHERE siteid = '1' LIMIT 1");

if ($query->num_rows() > 0) {
        // do stuff
}

However, currently your create_site() method in your Site_model is returning a single row (return $row;) from the result object, and then you're trying to call num_rows() on that single row in your SiteObj controller.

There really is no need to do this because $query->row(); will always return a single result row.

If you did absolutely want to call num_rows() from inside your controller (again, there's really no point since $query->row() will always return only one row), you must return the entire $query result object like this:

$query = $this->db->query("SELECT * FROM sites WHERE siteid = '1' LIMIT 1");

if ($query->num_rows() > 0) {
    return $query;
}

Then in your SiteObj controller:

$this->load->model('Site_model');

$data = $this->Site_model->create_site();

if ($data->num_rows() == 1) {
    //etc. etc.
}

Hope that helps - if not let me know. It doesn't look like your code is too far off! For reference, check out the num_rows() method and the row() method.

Codeigniter 控制器和模型的问题

更多

推荐作者

吝吻

文章 0 评论 0

Jasmine

文章 0 评论 0

∞梦里开花

文章 0 评论 0

阳光①夏

文章 0 评论 0

暮念

文章 0 评论 0

梦里泪两行

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文