小编use*_*331的帖子

CodeIgniter get_where order_by

我想使用get_where和order_by这样...

$query = $this->db->get_where($this->tbl_name, $where)->order_by('birth_date', 'ASC');
Run Code Online (Sandbox Code Playgroud)

但得到了这个错误......

Fatal error: Call to undefined method CI_DB_mysql_result::order_by() in C:\xampp\htdocs\OAWA\application\models\Member_model.php on line 82
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

php codeigniter

10
推荐指数
1
解决办法
3万
查看次数

CSS围绕几何图像包装文本

是否可以将文本环绕在圣诞树上并使文本触及边缘?

我左边有一个文本块,右边有一个文本块,我想把树放在中间,左右边有文字环绕,这可能吗?

HTML:

<div class="main-content">
    <div class="left-text">
        <p class="left">Sed pretium dapibus lorem. Morbi sed diam eu dolor fermentum pharetra. Aliquam quis erat maximus ligula tincidunt tincidunt vel sed dolor. Curabitur sed aliquet mi. Morbi quis ipsum non ante consectetur varius. Fusce dapibus posuere metus, nec interdum ante. Curabitur magna odio, interdum at est nec, vulputate faucibus quam. Aliquam est nisi, ultricies in mauris quis, venenatis tristique urna. Integer tristique, orci lobortis egestas feugiat, enim massa hendrerit turpis, quis dictum purus …
Run Code Online (Sandbox Code Playgroud)

html css

10
推荐指数
1
解决办法
241
查看次数

SQL存储过程LIKE

这是一个简单的问题,我似乎无法想到解决方案.

我在我的存储过程中定义了这个:

@communityDesc varchar(255) = NULL
Run Code Online (Sandbox Code Playgroud)

@communityDesc是"aaa,bbb,ccc"

在我的实际查询中,我正在尝试使用 IN

WHERE AREA IN (@communityDesc)
Run Code Online (Sandbox Code Playgroud)

但这不起作用,因为我的逗号在字符串内,而不是像"aaa","bbb","ccc"

所以我的问题是,我能对@communityDesc做些什么,所以它可以用我的IN语句,比如重新格式化字符串?

sql

10
推荐指数
2
解决办法
401
查看次数

带有整数字符串的枚举

我有这样一个公众enum:

public enum occupancyTimeline
{
    TwelveMonths,
    FourteenMonths,
    SixteenMonths,
    EighteenMonths
}
Run Code Online (Sandbox Code Playgroud)

我将用于这样的DropDown菜单:

@Html.DropDownListFor(model => model.occupancyTimeline, 
   new SelectList(Enum.GetValues(typeof(CentralParkLCPreview.Models.occupancyTimeline))), "")
Run Code Online (Sandbox Code Playgroud)

现在我正在寻找我的价值观

12个月,14个月,16个月,18个月而不是TweleveMonths,十四个月,十六个月,十八个月

我怎么做到这一点?

c# asp.net asp.net-mvc

10
推荐指数
1
解决办法
995
查看次数

使用UITableView Cell的Swift 4 AlamofireImage

我正在使用AlamofireImages尝试从服务器下载图像并将其显示在我的表格视图单元格中,这是我得到的,但我的图像没有出现,只有textLabel和detailTextLabel

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let cell = tableView.dequeueReusableCell(withIdentifier: "trendingCell", for: indexPath)

        print(self.array[indexPath.row])

        cell.textLabel?.text = (self.array[indexPath.row]["title"] as! String)

        cell.detailTextLabel?.text = (self.array[indexPath.row]["username"] as! String)

        Alamofire.request("http://xxxxxxx.com/uploads/" + (self.array[indexPath.row]["cover"] as! String)).responseImage { response in
            if let image = response.result.value {
                cell.imageView?.image = image
            }
        }

        return cell
    }
Run Code Online (Sandbox Code Playgroud)

uitableview ios swift alamofire alamofireimage

10
推荐指数
1
解决办法
1642
查看次数

Swift - 在旋转时将UIImageView保持在相同位置

我有UIWebView,在其scrollView中,我添加了一个UIImageView,如下所示:

self.webview.scrollView.addSubview(image)
Run Code Online (Sandbox Code Playgroud)

我的问题是当我将设备从纵向旋转到横向时,UIImageView没有停留在我最初在scrollView上设置的位置,我理解屏幕的宽度和高度变化,我想我想要改变它在我的UIImageView上的位置,所以它似乎没有改变.

我有这个方法:

 override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {

        var newScrollViewFrame = webview.scrollView.frame
        var newFrame = webview.frame

        newFrame.size.width = size.width
        newFrame.size.height = size.height

        newScrollViewFrame.size.width = size.width
        newScrollViewFrame.size.height = size.height

        webview.frame = newFrame
        webview.scrollView.frame = newScrollViewFrame

    }
Run Code Online (Sandbox Code Playgroud)

此方法中的当前代码只调整UIWebView及其滚动视图的大小,但不调整scrollView中的UIImageViews

任何帮助,将不胜感激.

谢谢,

我尝试过以下方法:

for views in webview.scrollView.subviews
        {
            if(views.isKindOfClass(UIImageView))
            {
                views.transform = CGAffineTransformMakeRotation(CGFloat(M_PI)/2);

            }
        }
Run Code Online (Sandbox Code Playgroud)

但这会在旋转时侧向放置UIImageView

以下是我如何将webview添加到视图中:

webview = UIWebView()

        webview.frame = self.view.bounds
        webview.scrollView.frame = webview.frame

        webview.userInteractionEnabled = true
        webview.scalesPageToFit = true
        webview.becomeFirstResponder()
        webview.delegate = self
        webview.scrollView.delegate = self
        self.view.addSubview(webview) …
Run Code Online (Sandbox Code Playgroud)

ios swift

9
推荐指数
1
解决办法
2687
查看次数

Swift 3 Type'Any'没有下标成员

我刚刚将我的项目转换为Swift 3我在这里有这行代码:

let type = self.data[indexPath.row]["Type"] as? String
Run Code Online (Sandbox Code Playgroud)

但现在我收到这个错误:

Type 'Any' has no subscript members
Run Code Online (Sandbox Code Playgroud)

为什么我会收到此错误并修复它?

ios swift swift3

9
推荐指数
1
解决办法
1万
查看次数

URLSession不适用于URLCredential

我有一个我想连接的API,服务器是Windows身份验证.

我正在尝试将URLSession与URLCredential一起使用委托方法

func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Swift.Void){

        var disposition: URLSession.AuthChallengeDisposition = URLSession.AuthChallengeDisposition.performDefaultHandling

        var credential:URLCredential?

        print(challenge.protectionSpace.authenticationMethod)

        if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {
            credential = URLCredential(trust: challenge.protectionSpace.serverTrust!)

            if (credential != nil) {
                disposition = URLSession.AuthChallengeDisposition.useCredential
            }
            else
            {
                disposition = URLSession.AuthChallengeDisposition.performDefaultHandling
            }
        }
        else
        {
            disposition = URLSession.AuthChallengeDisposition.cancelAuthenticationChallenge
        }

        completionHandler(disposition, credential);
    }
Run Code Online (Sandbox Code Playgroud)

执行某些打印后,此代码运行两次,因为有两种身份验证方法:

NSURLAuthenticationMethodServerTrust和NSURLAuthenticationMethodNTLM在通过NSURLAuthenticationMethodServerTrust运行时一切正常,但是当它运行NSURLAuthenticationMethodNTLM时,我在此行上收到错误:

credential = URLCredential(trust: challenge.protectionSpace.serverTrust!)
Run Code Online (Sandbox Code Playgroud)

这样说:

fatal error: unexpectedly found nil while unwrapping an Optional value
Run Code Online (Sandbox Code Playgroud)

但只有当我改变这个条件时

if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust { …
Run Code Online (Sandbox Code Playgroud)

ios swift swift3

9
推荐指数
1
解决办法
1318
查看次数

固定的CSS位置不会出现在移动设备上

我有一个像这个css的元素:

element.style {
    background-image: url(image.jpg);
}
.panel-image {
    background-position: center center;
    background-repeat: no-repeat;
    -webkit-background-size: cover;
    background-size: cover;
    position: relative;
}
Run Code Online (Sandbox Code Playgroud)

我现在正试图使它成为一个固定的位置,所以当我尝试执行以下操作时:

.panel-image {
    background-position: center center;
    background-repeat: no-repeat;
    -webkit-background-size: cover;
    background-size: cover;
    position: fixed;
    width: 100%;
    height: 200px;
}
Run Code Online (Sandbox Code Playgroud)

该元素不再出现在页面上.

有一个元素包围这个元素:

.twentyseventeen-panel {
    overflow: hidden;
    position: relative;
}
Run Code Online (Sandbox Code Playgroud)

这是html:

<article id="panel1" class="twentyseventeen-panel  post-47 page type-page status-publish has-post-thumbnail hentry">


        <div class="panel-image" style="background-image: url(https://2017.wordpress.net/wp-content/uploads/2016/10/pexels-photo-30724-2000x1200.jpg);">
            <div class="panel-image-prop" style="padding-top: 60%"></div>
        </div><!-- .panel-image -->


    <div class="panel-content">
        <div class="wrap">
            <header class="entry-header">
                <h2 class="entry-title">Our Drinks</h2>

            </header><!-- .entry-header …
Run Code Online (Sandbox Code Playgroud)

css

9
推荐指数
1
解决办法
982
查看次数

从存储过程中获取XML

我从存储过程中获取XML输出.我想要做的是获取XML并通过ASP.NET传递出来:

public XmlDocument GetPunchListXml(string communityDesc)
{
    try
    {
        using (connection = new SqlConnection(connectionString))
        {
             connection.Open();

             using (SqlCommand command = new SqlCommand("GetPunchList", connection))
             {
                   command.CommandType = CommandType.StoredProcedure;

                   SqlParameter parameter1 = new SqlParameter("@communityDesc", SqlDbType.VarChar);
                   parameter1.Value = communityDesc;
                   parameter1.Direction = ParameterDirection.Input;
                   command.Parameters.Add(parameter1);

                   var doc = new XmlDocument();
                   var reader = command.ExecuteXmlReader();
                   if (reader.Read())
                   {
                       doc.Load(reader);
                   }

                   return doc;
               }
           }
      }
      finally
      {
         connection.Close();
      }
}
Run Code Online (Sandbox Code Playgroud)

但我一直收到这些错误:

<Error>
    <Message>An error has occurred.</Message>
    <ExceptionMessage>
        The 'ObjectContent`1' type failed to serialize the response body for …
Run Code Online (Sandbox Code Playgroud)

c# xml sql-server asp.net

8
推荐指数
1
解决办法
1807
查看次数