小编Xav*_*osa的帖子

PHP SimpleXML:删除带有for的项目

我只需要从simpleXML元素中删除一个项目:

unset($this->simpleXML->channel->item[0]);
Run Code Online (Sandbox Code Playgroud)

但我不能用a表示:

    $items = $this->simpleXML->xpath('/rss/channel/item');
    for($i = count($items); $i > $itemsNumber; $i--) {
        unset($items[$i - 1]);
    }
Run Code Online (Sandbox Code Playgroud)

一些项目从$ items中删除(Netbeans Debug可以确认)但是当我再次获得路径时(/ rss/channel/item)没有删除任何内容.

怎么了?

php xml simplexml

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

twitter登录:401客户端错误:需要授权

我正在使用python-social-auth在本地实现twitter登录,但我得到401客户端错误.我的django版本是1.6.

Traceback:
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
  112.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Library/Python/2.7/site-packages/social/apps/django_app/utils.py" in wrapper
  45.             return func(request, backend, *args, **kwargs)
File "/Library/Python/2.7/site-packages/social/apps/django_app/views.py" in auth
  12.     return do_auth(request.social_strategy, redirect_name=REDIRECT_FIELD_NAME)
File "/Library/Python/2.7/site-packages/social/actions.py" in do_auth
  25.     return strategy.start()
File "/Library/Python/2.7/site-packages/social/strategies/base.py" in start
  66.             return self.redirect(self.backend.auth_url())
File "/Library/Python/2.7/site-packages/social/backends/oauth.py" in auth_url
  99.         token = self.set_unauthorized_token()
File "/Library/Python/2.7/site-packages/social/backends/oauth.py" in set_unauthorized_token
  158.         token = self.unauthorized_token()
File "/Library/Python/2.7/site-packages/social/backends/oauth.py" in unauthorized_token
  177.                                 method=self.REQUEST_TOKEN_METHOD)
File "/Library/Python/2.7/site-packages/social/backends/base.py" in request
  205.         response.raise_for_status()
File "/Library/Python/2.7/site-packages/requests/models.py" in raise_for_status
  808.             raise HTTPError(http_error_msg, response=self) …
Run Code Online (Sandbox Code Playgroud)

python django twitter-oauth python-social-auth

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