Tag: PHP的

在用添加值之前是否需要声明PHP数组?

$arr = array(); // is this line needed? $arr[] = 5; 我知道它没有第一条线,但它通常包含在实践中。 是什么原因? 没有它不安全? 我知道你也可以这样做: $arr = array(5); 但我正在谈论的情况下,你需要逐项添加项目。

用PHP读取mp4文件

我想用PHP读取mp4文件,现在我正在做的是这样的: <?php header("Content-Length: filesize"); readfile('file.mp4'); ?> 但这样我就不能跳过,甚至回到video未被加载100%。 当然,当我直接从文件(video.mp4)读取一切顺利。 谢谢。

拆分关键字后的PHP MySQL

我有一个表存储邮政编号,它的标签如: Post_id | Tags ————————————– 1 | keyword1,keyword2,keyword3 我想循环这个表格中的每一行,并执行: 把关键字1,关键字2,关键字3放在新表中: word_id | word_value ————————- 1 | keyword1 2 | keyword2 3 | keyword3 得到mysql_insert_id()foreach(或者如果word_value已经存在,则存在word_id),然后放入新表中,如: post_id | word_id —————— 1 | 1 1 | 2 1 | 3 我已经使用PHP和MySQL做这个任务,但这是慢慢的。 任何人有好主意?

PHP邮件特殊字符utf8

我有以下脚本: <?php $subject = "Testmail — Special Characters"; $msg = "Hi there,\n\nthis isn't something easy.\n\nI haven't thought that it's that complicated!"; mail($to,$subject,$msg,$from."\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n"); ?> 在电子邮件中: 主题: Testmail ? Special Characters Testmail ? Special Characters 身体: Hi there, this isn?t something easy. I haven?t thought that it?s that complicated! 我尝试了很多东西,但我没有任何想法了。 你可以帮我吗? 你有没有这个工作? 谢谢!

张贴到Facebook页面没有“manage_pages”权限使用PHP

我有一个包含博客文章的网站。 我们需要自动发布博客到Facebook页面。 我可以贴在我的时间表上。 但我不能张贴到Facebook页面。 我在谷歌search。 许多代码表示我们需要manage_pages权限。 *我的应用程序,Facebook页面在同一个帐户。 我已提交manage_pages以供审批。 他们说,由于您是应用程序和Facebook页面的pipe理员,您可以发布到您的页面而无需manage_page权限。 但总是我收到#200错误。 他们被拒绝的答复是:“您不需要申请这些权限,因为您的博客或CMS与您pipe理的应用程序集成在一起。作为应用程序pipe理员,您已经可以访问这些权限并发布到您的时间轴或您pipe理的页面。可以通过添加他们作为您的应用程序的开发人员提供访问额外的用户。“ 我需要代码张贴到Facebook页面没有manage_pages权限,因为他们解释

php文件的函数列表

如何获取在php文件中声明的函数列表

如何使用jQuery / AJAX和PHP / MySQL根据第一个下拉列表select第二个下拉列表?

我正在尝试使用jQuery / AJAX和PHP / MySQL创build一组dynamic的下拉框。 当页面基于来自数据库的值加载时,第一个下拉框将被填充。 第二个下拉框应显示一组基于从第一个下拉框中select的值。 我知道在这里曾经有类似的问题,但是我还没有find符合我的情况的解决scheme。 我的查询生成第二个下拉列表的JSON编码值列表正在运行,但我有问题填充到实际的下拉表单元素。 任何想法,我要去哪里错了。 使用Javascript: <script> $().ready(function() { $("#item_1").change(function () { var group_id = $(this).val(); $.ajax({ type: "POST", url: "../../db/groups.php?item_1_id=" + group_id, dataType: "json", success: function(data){ //Clear options corresponding to earlier option of first dropdown $('select#item_2').empty(); $('select#item_2').append('<option value="0">Select Option</option>'); //Populate options of the second dropdown $.each( data.subjects, function(){ $('select#item_2').append('<option […]

PHP SimpleXML:在某个位置插入节点

说我有XML: <root> <nodeA /> <nodeA /> <nodeA /> <nodeC /> <nodeC /> <nodeC /> </root> 如何在As和Cs之间插入“nodeB”? 在PHP中,最好通过SimpleXML? 喜欢: <root> <nodeA /> <nodeA /> <nodeA /> <nodeB /> <nodeC /> <nodeC /> <nodeC /> </root>

PHPrecursion目录path

我有这个函数返回full directory tree : function getDirectory( $path = '.', $level = 0 ){ $ignore = array( 'cgi-bin', '.', '..' ); // Directories to ignore when listing output. Many hosts // will deny PHP access to the cgi-bin. $dh = @opendir( $path ); // Open the directory to the handle $dh while( false !== ( $file […]

从PHP获取string中的数字

我有string: $one = 'foo bar 4 baz (5 qux quux)'; $two = 'bar baz 2 bar'; $three = 'qux bar 12 quux (3 foo)'; $four = 'foo baz 3 bar (13 quux foo)'; 我怎样才能find这些string中的数字? 也许与function: function numbers($string){ // ??? $first = ?; $second = ?; } 例如: function numbers($one){ // ??? $first = 4; $second […]