Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过php向flash对象添加一些参数_Php - Fatal编程技术网

通过php向flash对象添加一些参数

通过php向flash对象添加一些参数,php,Php,我有一个挑战,我提交的数据与flash对象youtube视频 我想查看这个数据的字符串,看看是否有一个对象,然后b1在对象内部添加一些参数,2在嵌入中添加相同的属性 到目前为止我已经 // check if the content contains a youtube video... and that it doesn't have the opaque wmode if(strstr($content, '<object') && strstr($content

我有一个挑战,我提交的数据与flash对象youtube视频

我想查看这个数据的字符串,看看是否有一个对象,然后b1在对象内部添加一些参数,2在嵌入中添加相同的属性

到目前为止我已经

// check if the content contains a youtube video... and that it doesn't have the opaque wmode
if(strstr($content, '<object')   &&  strstr($content != 'wmode="opaque"')) {


   // split the string after the object tag, and insert the <param tag

   // find the occurance of the <embed tag and insert the attribute

 }
然后我意识到,如果数据在$content字符串中包含2个或更多的对象,那么会发生什么呢?因此,解决方案需要对$content变量中的每个对象使用某种循环函数

我想我需要

计算变量中存在对象的次数。 循环遍历每一个,并为每一个eek执行上述代码
我的做法正确吗?您认为什么是最好的解决方案?

尝试以下方法:

if(preg_match_all('/<object(.*?)<\/object>/', $content, $matches)) {
   print_r ($matches);
}