小编use*_*333的帖子

如何摆脱"GIT STATUS"上的消息奇怪消息?

突然出现了:

MacBook-Pro: $ git status
On branch dev
Your branch is up-to-date with 'dropbox/dev'.
You are currently editing a commit while rebasing branch 'Releases' on '72ca998'.
  (use "git commit --amend" to amend the current commit)
  (use "git rebase --continue" once you are satisfied with your changes)

nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)

分店没有变化.一切都是最新的.

git

22
推荐指数
3
解决办法
8374
查看次数

什么是更好的使用:in_array或array_unique?

我怀疑使用什么:

foreach(){
    // .....

    if(!in_array($view, $this->_views[$condition]))
        array_push($this->_views[$condition], $view);

    // ....
}
Run Code Online (Sandbox Code Playgroud)

要么

foreach(){
    // .....

    array_push($this->_views[$condition], $view);

    // ....
}

$this->_views[$condition] = array_unique($this->_views[$condition]);
Run Code Online (Sandbox Code Playgroud)

UPDATE

目标是获得一系列独特的价值观.这可以通过每次检查值是否已存在in_array或每次添加所有值或最终使用时来完成array_unique.那么这两种方式之间有什么重大区别吗?

php arrays array-unique

12
推荐指数
1
解决办法
2340
查看次数

如何在Joomla视图中更改负载布局?

默认情况下 parent::display($tpl);加载components/com_my_component/views/my_component/tmpl/default.php,但在某些情况下我需要加载其他php文件,它位于相同的文件夹附近default.php(例如components/com_my_component/views/my_component/tmpl/lol.php).如何做到这一点view.html.php.

PS

尝试负载loadTemplatesetLayout方法没有运气.

joomla joomla2.5

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

如何在OS X 10.9上使用OpenSSL编译PHP?

我正在尝试从源代码编译PHP 5.6.10,我遇到了以下问题:

Undefined symbols for architecture x86_64:
  "_PKCS5_PBKDF2_HMAC", referenced from:
      _zif_openssl_pbkdf2 in openssl.o
  "_TLSv1_1_client_method", referenced from:
      _php_openssl_setup_crypto in xp_ssl.o
  "_TLSv1_1_server_method", referenced from:
      _php_openssl_setup_crypto in xp_ssl.o
  "_TLSv1_2_client_method", referenced from:
      _php_openssl_setup_crypto in xp_ssl.o
  "_TLSv1_2_server_method", referenced from:
      _php_openssl_setup_crypto in xp_ssl.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libs/libphp5.bundle] Error 1
Run Code Online (Sandbox Code Playgroud)

OpenSSL通过Brew安装.在PHP中包括像--with-openssl=/usr/local/Cellar/openssl/1.0.2c

PS之前尝试仅/usr用于OpenSSL但得到了同样的错误.

php homebrew openssl osx-mavericks

7
推荐指数
1
解决办法
2184
查看次数

如何在Laravel 5中调用模型?

所以,在L5中我创建了文件夹app/Models/Blog,其中的文件Posts.php看起来像:

<?php namespace App\Models\Blog;

use Illuminate\Database\Eloquent\Model;

class Posts extends Model {
    protected $table = 'posts';
}
Run Code Online (Sandbox Code Playgroud)

之后我执行了composer dump然后在我的控制器中:

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Models\Blog\Posts as Posts;

class BlogController extends Controller {

    public function index()
    {
        $post = Posts::all()->toArray();

        dd($post);
    }
}
Run Code Online (Sandbox Code Playgroud)

它抛出了一个错误:

FatalErrorException in BlogController.php line 14: Class 'Models\Blog\Posts' not found
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-5

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

有可能以某种方式同步调用异步离子存储吗?

我正在尝试创建一个在类顶部使用API​​的Angular2 HTTP类.主要的是我需要添加自定义的auth标头,在用户授权后可用.

主要问题是令牌存储在Ionic Storage模块中,只能异步获取,但我需要返回特定的类型....

export class APIRequest extends Http {

    private storage : Storage;

    constructor (backend: XHRBackend, options: RequestOptions) {
        super(backend, options);

        this.storage = new Storage;
    }

    request(url: string|Request, options?: RequestOptionsArgs): Observable<Response> {
        if (typeof url === 'string') {
            url = AppConfig.API_SERVER + url
        } else {
            url.url = AppConfig.API_SERVER + url.url
        }

        this.storage.get('authToken').then(token => {
            if (typeof url === 'string') {
                if (!options) {
                    options = {headers: new Headers()};
                }

                options.headers.set('Authorization', `Bearer ${token}`);
            } else {
                url.headers.set('Authorization', …
Run Code Online (Sandbox Code Playgroud)

typescript ionic-framework ionic2 angular2-http angular

5
推荐指数
1
解决办法
3193
查看次数

如何在jQuery移动或单选按钮中点击?

我有一组按钮使用jquery mobile:

<fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" style="text-align:center">
    <input id="radio1" name="" value="site" type="radio">
    <label for="radio1">
        Site
    </label>
    <input id="radio2" name="" value="transmitter" type="radio">
    <label for="radio2">
        Transmitter
    </label>
    <input id="radio3" name="" value=" channel" type="radio">
    <label for="radio3">
        Channel
    </label>
</fieldset>
Run Code Online (Sandbox Code Playgroud)

我需要在点击或抓住点击时显示弹出窗口并手动显示.问题是jquery mobile单独呈现此内容.那有可能吗?

jquery radio-button jquery-mobile

4
推荐指数
1
解决办法
6471
查看次数

如何在JQM中以编程方式创建列表视图

我有一个来自ajax的数组,我需要创建jQuery Mobile Listview.我没有找到这方法,所以有可能吗?

html jquery jquery-mobile jquery-mobile-listview

4
推荐指数
1
解决办法
2737
查看次数

如何在joomla控制器中加载不同的视图?

我有简单的线条,但它不起作用.

$this->getView($input->get('my_wiew', 'Sites', 'CMD'), 'HTML');
//some code
parent::display();
Run Code Online (Sandbox Code Playgroud)

如果我简单地转到网址index.php?option=com_my_component&view=sites我得到我的视图,但默认情况下它不想加载.

joomla joomla2.5

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

如何在Laravel中创建新用户?

我创建了模型:

<?php
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

class ClientModel extends Eloquent implements UserInterface, RemindableInterface {

    protected $connection = 'local_db';
    protected $table      = 'administrators';
    protected $fillable   = ['user_id'];

    public function getAuthIdentifier()
    {
        return $this->username;
    }

    public function getAuthPassword()
    {
        return $this->password;
    }

    public function getRememberToken()
    {
        return $this->remember_token;
    }

    public function setRememberToken($value)
    {
        $this->remember_token = $value;
    }

    public function getRememberTokenName()
    {
        return 'remember_token';
    }

    public function getReminderEmail()
    {
        return $this->email;
    }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试使用它时:

ClientModel::create(array(
    'username' => 'first_user',
    'password' => Hash::make('123456'),
    'email'    => …
Run Code Online (Sandbox Code Playgroud)

php authentication laravel eloquent

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