小编Sil*_*ost的帖子

PHP嵌入在Javascript中

在我的项目中我有这样的情况.

<script language="JavaScript">
function fonsubmit()
{
    alert('Out side PHP');
    //Here the php code starts 
    include("customerpage.php");
    $cc="us";
    $clang="en";
    $cpath="us"; 
    some coding goes here......
    Php ends here
}
</script>
Run Code Online (Sandbox Code Playgroud)

但它显示了Object预期的错误.这有什么问题?但我只给PHP标签它不会产生任何错误.请帮我解决这个问题,提前谢谢......

javascript php

0
推荐指数
1
解决办法
9642
查看次数

我如何在python中为以下模式编写正则表达式?

我如何在python中使用正则表达式查找以下模式?对于这两个案件

我在"="符号后面寻找str2

  • 情况1: str1=str2
  • 案例2: str1 = str2

请注意,在"="符号的两边之间可以有空格或没有空格

我的是这样的,但只适用于其中一个案例!

m=re.search('(?<=str\s\=\s)\w+','str = str2')
Run Code Online (Sandbox Code Playgroud)

返回str2

救命!

迦特

python regex string

0
推荐指数
1
解决办法
466
查看次数

获取Google索引动态PHP页面

我打算建立一个网站,其链接没有设置HTML页面(例如mypage.com/contact_me.html)但动态(profile.php?uid = 32320&mode = 2).

我怎样才能让谷歌为这样的网站编制索引,以便每个个人资料(很像facebook已经完成)在谷歌上单独编制索引?

谢谢!

sitemap indexing url

0
推荐指数
1
解决办法
1603
查看次数

字符串格式

我不知道为什么结肠在第二次左转

>>> print '%5s' %':'
    :
>>> print '%5s' %':' '%2s' %':'
 : :
Run Code Online (Sandbox Code Playgroud)

请帮帮我

python string format

0
推荐指数
1
解决办法
791
查看次数

按属性排序对象列表

我试图在python中对对象列表进行排序,但是这段代码不起作用:

import datetime

class Day:
    def __init__(self, date, text):
        self.date = date
        self.text = text

    def __cmp__(self, other):
        return cmp(self.date, other.date)

mylist = [Day(datetime.date(2009, 01, 02), "Jan 2"), Day(datetime.date(2009, 01, 01), "Jan 1")]
print mylist
print mylist.sort()
Run Code Online (Sandbox Code Playgroud)

这个输出是:

[<__main__.Day instance at 0x519e0>, <__main__.Day instance at 0x51a08>]
None
Run Code Online (Sandbox Code Playgroud)

有人能告诉我解决这个问题的好方法吗?为什么sort()函数返回None

python

0
推荐指数
1
解决办法
602
查看次数

关于PHP fopen的警告

$file = @fopen("http://ajax.htm","rb");
Run Code Online (Sandbox Code Playgroud)

我在使用时收到此错误 fopen

Warning: fopen(xyz.htm): failed to open stream: HTTP request failed! 
in /home/user/public_html/aaa/ttt.php on line 8
Run Code Online (Sandbox Code Playgroud)

这背后的原因是什么?

php fopen

0
推荐指数
1
解决办法
3163
查看次数

如何通过纺织品建立联系?

是否可以将样式属性或类应用于纺织品中?我试图找到一个参考,但一无所获.

css textile

0
推荐指数
1
解决办法
1339
查看次数

使用php DEFINE中的变量的Twitter API错误

我正在尝试将用户名和密码变量传递给twitter凭据,但它会一直返回,我没有通过身份验证.但是,当我使用实际的用户名和密码而不是变量时,它会成功授权.

$username = $_POST["username"];
$password = $_POST["password"];

$url = "http://search.twitter.com/search.atom?q=golf&show_user=true&rpp=100";
$search = file_get_contents($url);

$regex_name = '/\<name\>(.+?) \(/';
preg_match_all($regex_name,$search,$user);
for($i=0;$user[1][$i];$i++)
{
$follow = $user[1][$i];
    define('TWITTER_CREDENTIALS', '$username:$password');
    $url = "http://twitter.com/friendships/create/".$follow.".xml";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_USERPWD, TWITTER_CREDENTIALS);
    $result= curl_exec ($ch);
    curl_close ($ch);
Run Code Online (Sandbox Code Playgroud)

我认为它与用户名和密码之间的冒号有关,或者可能试图在define函数中使用变量.

有线索吗?

php twitter

0
推荐指数
1
解决办法
611
查看次数

列表的打印表示

我想用这种方式将列表格式化为字符串: [1,2,3] => '1 2 3'.这该怎么做?Python中是否有任何可自定义的格式化程序作为Common Lisp格式?

python

0
推荐指数
2
解决办法
167
查看次数

数组中的文本文件格式

我没有:数组,我喜欢把它带到特定格式的文本文件,例如,

'现在形式'

a= [1 2 3 4 5 ]

b= [ 1 2 3 4 5 6 7 8 ]  

c= [ 8 9 10 12 23 43 45 56 76 78]

d= [ 1 2 3 4 5 6 7 8 45 56 76 78 12 23 43 ]
Run Code Online (Sandbox Code Playgroud)

txt文件中的"必需格式",

   a   '\t'    b      '\t'     d  '\t'    c

   1   '\t'    1  

   2    '\t'   2  

   3    '\t'   3  

   4    '\t'   4  

   5   '\t'    5  

      6   

      7              

      8        
Run Code Online (Sandbox Code Playgroud)

'\t'- 1个标签空间

问题是, …

python

0
推荐指数
1
解决办法
1023
查看次数

标签 统计

python ×5

php ×3

string ×2

css ×1

fopen ×1

format ×1

indexing ×1

javascript ×1

regex ×1

sitemap ×1

textile ×1

twitter ×1

url ×1